File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed
Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,15 @@ logger.setDate(() => (new Date()).toLocaleTimeString())
178178logger.info("This is an info message") // 5:17:59 pm [INFO] This is an info message
179179```
180180
181+ ### ` createNamedLogger() `
182+
183+ You can named a logger by ` createNamedLogger() `
184+
185+ ```
186+ logger.createNamedLogger("Test 4");
187+ logger.error('error show'); // 2022-08-18T01:38:13.277Z [Test 4] [ERROR] error show
188+ ```
189+
181190### Log Files
182191
183192If you want to save the logs to files, you can use shell pipes:
Original file line number Diff line number Diff line change 1+ 10.0.0
2+ - Adding error catching to json stringify
3+ - Adding support for named loggers: ` createNamedLogger() `
4+
159.0.0
26- modify ` success() `
37
Original file line number Diff line number Diff line change 11{
22 "name" : " node-color-log" ,
3- "version" : " 9 .0.0" ,
3+ "version" : " 10 .0.0" ,
44 "description" : " The more powerful JavaScript logger for NodeJS and browsers." ,
55 "main" : " index.js" ,
66 "scripts" : {
7- "test" : " node test.js && LOGGER=info node test2.js"
7+ "test" : " node test.js && LOGGER=info node test2.js && node test3.js && LOGGER=info node test4.js "
88 },
99 "repository" : {
1010 "type" : " git" ,
Original file line number Diff line number Diff line change 11const logger = require ( './index' ) . createNamedLogger ( "Test 4" ) ;
22
3- // $ LOGGER=info node test2 .js
3+ // $ LOGGER=info node test4 .js
44logger . log ( '****************************************' ) ;
55logger . log ( '*** Test Environment Variable LOGGER ***' ) ;
66logger . log ( '****************************************' ) ;
You can’t perform that action at this time.
0 commit comments