logging-custom-service
v1.0.6
Published
logging-custom-service
Downloads
2
Maintainers
Readme
logging-custom-service
logging-custom-service
- Config show logging
- It has small dependencies include lodash,loglevel,loglevel-plugin-prefix.
Install module
npm install --save logging-custom-service
import module
let loggingService = require('logging-custom-service');
let log = loggingService();
log.trace('TEST log.trace');
log.debug('TEST log.debug');
log.log('TEST log.log');
log.info('TEST info');
log.warn('TEST warn');
log.error('TEST error');
log.error(
"aaaa",
{a:"a", b: new Date(), c:{c1:"c1", c222:"c222"}},
["d1","d2"],
{a:"a__"},
{
e:{e1:"e1",e2:"e2",}
},
"hello world"
);
log.info(
{
message:"heeello",
a:"a",
b: new Date(),
c:{c1:"c1", c222:"c222"},
d:["d1","d2","d3"]
}
);
log.warn(
{
message:"heeello",
a:"a",
b: new Date(),
c:{c1:"c1", c222:"c222"}
}
);
Result terminal
{"message":"aaaa dddddd hello world","content":"aaaa dddddd hello world","timestamp":"2020-10-16T04:16:32.156Z","log_level":"ERROR","arguments_0":"aaaa","a":"a","b":"2020-10-16T04:16:32.155Z","c":{"c1":"c1","c222":"c222"},"c1":"c1","c222":"c222","arguments_1":"{\"a\":\"a\",\"b\":\"2020-10-16T04:16:32.155Z\",\"c\":{\"c1\":\"c1\",\"c222\":\"c222\"}}","arguments_2":"dddddd","arguments_3":"[\"d1\",\"d2\"]","a_dup_849":"a__","arguments_4":"{\"a\":\"a__\"}","e":{"e1":"e1","e2":"e2"},"e1":"e1","e2":"e2","arguments_5":"{\"e\":{\"e1\":\"e1\",\"e2\":\"e2\"}}","arguments_6":"hello world"}
{"message":"heeello","content":"heeello","timestamp":"2020-10-16T04:16:32.158Z","log_level":"INFO","a":"a","b":"2020-10-16T04:16:32.158Z","c":{"c1":"c1","c222":"c222"},"c1":"c1","c222":"c222","arguments_0":"{\"message\":\"heeello\",\"a\":\"a\",\"b\":\"2020-10-16T04:16:32.158Z\",\"c\":{\"c1\":\"c1\",\"c222\":\"c222\"}}"}
{"message":"heeello","content":"heeello","timestamp":"2020-10-16T04:16:32.158Z","log_level":"WARN","a":"a","b":"2020-10-16T04:16:32.158Z","c":{"c1":"c1","c222":"c222"},"c1":"c1","c222":"c222","arguments_0":"{\"message\":\"heeello\",\"a\":\"a\",\"b\":\"2020-10-16T04:16:32.158Z\",\"c\":{\"c1\":\"c1\",\"c222\":\"c222\"}}"}
Trace: {"message":"TEST log.trace","content":"TEST log.trace","timestamp":"2020-10-16T04:16:32.159Z","log_level":"TRACE","arguments_0":"TEST log.trace"}
at Logger.trace (/Users/v.nguyentvk/Site/npm-packages/loggingService/index.js:150:4)
at Object.<anonymous> (/Users/v.nguyentvk/Site/npm-packages/loggingService/app.js:32:5)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
{"message":"TEST log.debug","content":"TEST log.debug","timestamp":"2020-10-16T04:16:32.159Z","log_level":"DEBUG","arguments_0":"TEST log.debug"}
{"message":"TEST log.log","content":"TEST log.log","timestamp":"2020-10-16T04:16:32.159Z","log_level":"DEBUG","arguments_0":"TEST log.log"}
{"message":"TEST info","content":"TEST info","timestamp":"2020-10-16T04:16:32.159Z","log_level":"INFO","arguments_0":"TEST info"}
{"message":"TEST warn","content":"TEST warn","timestamp":"2020-10-16T04:16:32.159Z","log_level":"WARN","arguments_0":"TEST warn"}
{"message":"TEST error","content":"TEST error","timestamp":"2020-10-16T04:16:32.159Z","log_level":"ERROR","arguments_0":"TEST error"}