2.2.0 • Published 1 year ago
@jordbaer/logging v2.2.0
const log = require("@jordbaer/logging");
fmt: format string for util.format()
args: arguments for util.format()
prefix:
can be any value other than a string or an instance of String
if prefix is a function, this function is called to get the prefix
if prefix is an instanceof net.Server, the local socket address is the prefix
if prefix or prefix.socket or prefix._socket is an instance of net.Socket, the remote socket address is the prefix
log.stamp(date);
returns timestamp "YYYY-MM-DD hh:mm:ss.sss"
log.addListener(callback);
synchronous output via callback(stamp,seq,line)
log.addListener(stream ,encoding);
asynchronous output via instance of stream.Writable
if no listener is added, synchronous output is via console.error()
log.flushWait(stream)
returns Promise which is resolved, when all output is written