local skynet = require "skynet" require "skynet.manager" local queue = require "skynet.queue" local lfsUtil = require "utils.lfsUtil" local cs = queue() local baseService = require("baseService") local LOGGER = {} local CMD = {} local function open(filename) local handle = LOGGER[filename] if handle then return handle end handle = skynet.launch("jmlogger", filename) LOGGER[filename] = handle return handle end local function close(filename) if LOGGER[filename] then skynet.error("close logger ", filename) skynet.kill(LOGGER[filename]) LOGGER[filename] = nil end end function CMD.open(filename) return cs(open, filename) end function CMD.close(filename) return cs(close, filename) end function CMD.onStart() local statisticPath = skynet.getenv("statistic_path") assert(statisticPath) lfsUtil:create_path(statisticPath) end baseService.start(CMD, ".logMgr")