@kolabuk/logger
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

@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
Console output

File output
File output

Package Sidebar

Install

npm i @kolabuk/logger

Weekly Downloads

0

Version

1.2.0

License

ISC

Unpacked Size

9.72 kB

Total Files

6

Last publish

Collaborators

  • kolabuk