-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fixes, don't use console.log by default, improved support in edge…
… cases, improve tests
- Loading branch information
Showing
11 changed files
with
148 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tests | ||
.gitignore | ||
package-lock.json |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const logsJs = require('logs-js'); | ||
|
||
logsJs.log('test3 regular logging with no log level'); | ||
logsJs.log('test3 TRACE', logsJs.TRACE); | ||
logsJs.log('test3 DEBUG', logsJs.DEBUG); | ||
logsJs.log('test3 INFO', logsJs.INFO); | ||
logsJs.log('test3 WARN', logsJs.WARN); | ||
logsJs.log('test3 ERROR', logsJs.ERROR); | ||
logsJs.log('test3 FATAL', logsJs.FATAL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const logsJs = require('logs-js'); | ||
|
||
logsJs.log('test2 regular logging with no log level'); | ||
logsJs.log('test2 TRACE', logsJs.TRACE); | ||
logsJs.log('test2 DEBUG', logsJs.DEBUG); | ||
logsJs.log('test2 INFO', logsJs.INFO); | ||
logsJs.log('test2 WARN', logsJs.WARN); | ||
logsJs.log('test2 ERROR', logsJs.ERROR); | ||
logsJs.log('test2 FATAL', logsJs.FATAL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"defaultLogLevel": "INFO", | ||
"useConsoleLog": true, | ||
"log" : { | ||
"*": "ALL", | ||
"test.js": "ALL", | ||
"directory": { | ||
"*": "WARN", | ||
"nested_directory": { | ||
"test3.js": "DEBUG" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const logsJs = require('logs-js'); | ||
logsJs.loadConfig(require('./logs-conf.json')); | ||
|
||
require('./directory/test2.js'); | ||
require('./directory/nested_directory/test3.js'); | ||
|
||
console.time('test console.time'); | ||
console.timeEnd('test console.time'); | ||
|
||
console.log('%s def', 'abc'); | ||
console.log(); | ||
logsJs.trace(); | ||
logsJs.trace('test TRACE with trace() function'); | ||
logsJs.debug('test DEBUG with debug() function'); | ||
logsJs.info('test INFO with info() function'); | ||
logsJs.warn('test WARN with warn() function'); | ||
logsJs.error('test ERROR with error() function'); | ||
logsJs.fatal('test FATAL with fatal() function'); | ||
logsJs.log('test TRACE with log() function', logsJs.TRACE); | ||
logsJs.log('test DEBUG with log() function', logsJs.DEBUG); | ||
logsJs.log('test INFO with log() function', logsJs.INFO); | ||
logsJs.log('test WARN with log() function', logsJs.WARN); | ||
logsJs.log('test ERROR with log() function', logsJs.ERROR); | ||
logsJs.log('test FATAL with log() function', logsJs.FATAL); | ||
|
||
|
||
console.log('test regular logging with console.log() and no log level'); | ||
console.log('test TRACE with console.log() function', logsJs.TRACE); | ||
console.log('test DEBUG with console.log() function', logsJs.DEBUG); | ||
console.log('test INFO with console.log() function', logsJs.INFO); | ||
console.log('test WARN with console.log() function', logsJs.WARN); | ||
console.log('test ERROR with console.log() function', logsJs.ERROR); | ||
console.log('test FATAL with console.log() function', logsJs.FATAL); | ||
|
||
console.log('called from the root scope', logsJs.INFO); | ||
console.log('called with multiple arguments', 'abc', 'def', 0, 1, 2, logsJs.INFO); | ||
console.log({}, logsJs.INFO); | ||
console.log(JSON.stringify({"msg":"object with some text printted with JSON.stringify()"},null,2), logsJs.INFO); | ||
console.log([{}, 'abc', 3], logsJs.INFO); | ||
(() => { | ||
console.log('called from anonymous function', logsJs.INFO); | ||
})(); | ||
|
||
let c = () => { | ||
console.log('called from function c', logsJs.INFO); | ||
} | ||
|
||
function a(arg) { | ||
console.log(arg, logsJs.INFO); | ||
|
||
let b = () => { | ||
console.log('called from function b', logsJs.INFO); | ||
} | ||
b(); | ||
c(); | ||
} | ||
a('called from function a'); | ||
new a('called from constructor function a'); | ||
|
||
setTimeout(() => { | ||
console.log('called from timeout', logsJs.INFO); | ||
}, 1000); | ||
|