logol
Simple wrapper of console.log to had some color in the terminal.
Node
yarn add logolornpm install logol
const logol = ; logol;logol;logol;logol;logol;logol; // or ; ;;;;;;
Will output:
Deno
; info'test info', ;log'test log', ;success'test success', ;debug'test debug', ;warn'test warn', ;error'test error', ;
Experimental features
This are experimental features.
Filter log
Filter by stack trace
In some case you might want to filter some specific logs. To do this, use environment variable LOGOL_FILTER
by passing a regex. This regex will be applied on the stacktrace of the function calling the log. E.g: this is the stacktrace at run (/home/user/test.js:4:7)
, to display only this log we could do LOGOL_FILTER=test.js
.
To show the stacktrace of the log, use the enironment variable LOGOL_SHOW_STACK=true
.
Filter by level
To only show some specific log level, use environment variable LOGOL_LEVELS
where we can define wich log level to display, e.g.: LOGOL_LEVELS=error,warn
(each level is seprated by a "," without spacing)
Overwrite logol
In some case, we might need to overwrite the logger, for example to do unit test.
logol.logol.log =console.log'overwrite', ...params;logol.log'test log', ;