Node.js logger with ts declaration
npm i @kolabuk/logger
import { Logger } from "@kolabuk/logger";
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();