extsimpl.log

1.0.9 • Public • Published

An extremely simple logger

const Logger = require("extsimpl.log");

// Options are optional, mix and match
let options = {
    log_level: Logger.WARN,
    format: "[$level] [$time] $text",
    ignore_empty: false
}

const logger = new Logger("log.txt", options);

logger.log(new Array(10).fill(0), Logger.ERROR);
logger.log("test", Logger.WARN);
logger.log("test", Logger.INFO);

Console

[ERROR] [Tue, 05 Apr 2022 22:17:20 GMT] [0,0,0,0,0,0,0,0,0,0]
[WARN] [Tue, 05 Apr 2022 22:17:20 GMT] test
[INFO] [Tue, 05 Apr 2022 22:17:20 GMT] test

log.txt

[ERROR] [Tue, 05 Apr 2022 22:17:20 GMT] [0,0,0,0,0,0,0,0,0,0]
[WARN] [Tue, 05 Apr 2022 22:17:20 GMT] test

Readme

Keywords

none

Package Sidebar

Install

npm i extsimpl.log

Weekly Downloads

0

Version

1.0.9

License

ISC

Unpacked Size

2.75 kB

Total Files

3

Last publish

Collaborators

  • richard_r