2.3.2 • Published 9 months ago

ads-mylog v2.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

ads-mylog

Ads-mylog is a pre-configured logger that is built on top of the popular Winston library with sensible defaults. It is designed for who don't have spare time to spend on massive logging details and configurations.

With ads-mylog, logging is simple and is ready to use. Simply install, import the logger and start logging! The rest is ready to get started.

Intallation

npm install ads-mylog

How to use

Very simple!

const { log } = require('ads-mylog')

log.error('logging error')
log.warn('logging warn')
log.info('logging info')
log.debug('logging debug')

or, with TypeScript:

import { log } from 'ads-mylog'

log.error('logging error')
log.warn('logging warn')
log.info('logging info')
log.debug('logging debug')

Version Control

The ads-mylog writes log data to the logs folder. To maintain a clean version history, it's strongly recommended not track log files. To exclude log files, add the folling line to the .gitignore file:

logs/

Environment Configuration

This logger tool relies on ADS_MYLOG_CONSOLE_LEVEL environment variable to determine the log level in the console. This variable accepts all Winston log levels and is set to warn by default. However, it's recommended to use debug level during development to gain more visibility or thrubleshooting.

Follow one of the options to set up a log level:

  1. Set the environment using the command prompt

Open the terminal and start your application passing the relevant variable as:

ADS_MYLOG_CONSOLE_LEVEL=debug npm start

You can use whatever npm script, like npm run dev. This will set the environment variable to debug for the duration of the npm start command.

  1. Add the environment variable to the .env file.

Alternatively, you can add the ADS_MYLOG_CONSOLE_LEVEL variable straightforward to your .env file with the desired value:

ADS_MYLOG_CONSOLE_LEVEL=debug

This will set the log level to debug for all commands and scripts in your application so it will be disposal to ads-mylog.

Remember to set the log level according to your needs and development environment to ensure you get the appropriate level of logging information.

Contributions

It's an honor to receive any pull request from anyone.

2.3.0

9 months ago

2.2.1

9 months ago

2.2.0

9 months ago

2.3.2

9 months ago

2.2.3

9 months ago

2.3.1

9 months ago

2.2.2

9 months ago

2.2.4

9 months ago

2.1.0

10 months ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.5.0

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.0.0

1 year ago