Skip to content

original4sure/o4s-logger

Repository files navigation


Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. Contact

About The Project

This is a common logging library with newrelic integration

(back to top)

Built With

  • Node
  • TypeScript
  • Npm

(back to top)

Getting Started

Prerequisites

  1. 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

  1. 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

Installation

npm i https://github.com/original4sure/o4s-logger/tree/master

(back to top)

Usage

//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!!!");

Contributing

Feel free to make the changes and improve this !!!

(back to top)

Contact

Contact Dawn team for any kind of support needed we will be happy to help you !!!

(back to top)