add shutdown command for the logstore

pull/1/head
ansuz 6 years ago
parent 3676a6b923
commit ecd9647a2e

@ -52,6 +52,9 @@ var createLogType = function (ctx, type) {
return noop;
}
return function (tag, info) {
if (ctx.shutdown) {
throw new Error("Logger has been shut down!");
}
var time = new Date().toISOString();
var content;
try {
@ -98,7 +101,13 @@ Logger.create = function (config, cb) {
filePath: config.logPath,
}, function (store) {
ctx.store = store;
cb(Object.freeze(createMethods(ctx)));
var logger = createMethods(ctx);
logger.shutdown = function () {
delete ctx.store;
ctx.shutdown = true;
store.shutdown();
};
cb(Object.freeze(logger));
});
};

Loading…
Cancel
Save