Table of Contents
This is a common logging library with newrelic integration
- To init NewRelic in your application you must specify the below keys in your application .env
- 1.1 NODE_ENV
- 1.2 DEPLOY_ENV
- 1.3 NEW_RELIC_LICENSE_KEY or NEW_RELIC_LICENSE_KEY_2
- 1.4 ensure o4s-logger is import at the start of the main file
NOTE: if these keys are not present newrelic will not be initalized but you can still use the logging
- To Define log level you must specify the LOG_LEVEL in your application .env below are the log levels -
- error - 0
- warn - 1
- info - 2
- http - 3
- verbose - 4
- debug - 5
- silly - 6
NOTE: Where 0 is the highest priority and 6 is the least priority Example LOG_LEVEL=info will block http, verbose, debug, silly and allow info, warn, error only. Default LOG_LEVEL is info
npm i https://github.com/original4sure/o4s-logger/tree/master
//import logger
import { logger } from "@original4sure/o4s-logger";
// Logger with different log levels
logger.error("this is error!!!");
logger.warn("this is warn!!!");
logger.info("this is info!!!");
logger.http("this is http!!!");
logger.verbose("this is verbose!!!");
logger.debug("this is debug!!!");
logger.silly("this is silly!!!");
Feel free to make the changes and improve this !!!
Contact Dawn team for any kind of support needed we will be happy to help you !!!