@kolabuk/logger
v1.2.0
Published
Node.js logger with ts declaration
Downloads
3
Readme
@kolabuk/logger
Node.js logger with ts declaration
Installation
npm i @kolabuk/logger
Importing
import { Logger } from "@kolabuk/logger";
Usage
const logger = new Logger({
filePath: "./data/logs/index.txt",
errorFilePath: "./data/logs/err.txt",
debugMode: true,
debugWriteMode: "file", //console only/file only/console+file
useMilliseconds: false,
maxConsoleTextLen: 20, //slice console output if define, file output always full
});
logger.log("test data", {
background: "bgBlue",
});
logger.success("success");
logger.warn(null);
logger.error({ error: true, message: { json: "parsed" } });
logger.debug("Some debug data"); //ignored if debugMode==false
logger.close();
Console output
File output