@deepak-delta/logforge

1.0.1 • Public • Published

LogForge

Simple logger module

JavaScript TypeScript

Installation

$ npm install @deepak-delta/logforge

Quick start

The default settings are:

  • colorize: false
  • log: [ISO timestamp] [level] [message] [category] [metadata]
// /app/index.js
import { logger } from 'logforge'

logger.info('App', 'Application started', {
  version: '1.0.0',
  environment: 'production',
})

output
{"timestamp":"2024-04-01T10:31:15.174Z","level":"DEBUG","category":"App","message":"Application started","metadata":{"version":"1.0.0","environment":"production"}}

Configuration

The default configuration can be changed by creating lfconfig.json file in the root directory of the project

lfconfig.json

{
  "writeToFile": "false",
  "logFilePath": "",
  "timeStamp": "false",
  "setColor": "true"
}

Configure options

Name Type Default value Description
writeToFile Boolean fasle Output the log to file
logFilePath String null Path of log file
timeStamp Boolean true Turns on/off the timestamp
setColor Boolean false Turns on/off the colorized output

Configure options

  • loglevel - valid values are info, error, warn, and debug

Found a bug?

Feel free to open an issue on github.

Want to contribute?

Great! fork this repository and make a pull request😊.

Package Sidebar

Install

npm i @deepak-delta/logforge

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

2.8 kB

Total Files

2

Last publish

Collaborators

  • deepak-delta