brody_logger

2.2.1 • Public • Published

Utility-Tool

Logging utility tool

installation

$ npm install brody_logger

Usage

Version Bumper

With the utility tool required to your node file call the .bump method with the arguments of Semantic Version Number and how you would like the number incremented ('Major', 'Minor', or 'Patch'). This is case insensitive. Your server will require access to the .env file. I recommend adding the 'dotenv' node module

$ npm i --save dotenv
require('dotenv').config();
const logger = require('brody_logger');
 
// Note: You should supply the old version number dynamically
const newVersionNumber = logger.bump('1.11.111', 'patch'));

Logging

  • To enable debugging create an environmental variable in the .env file and set it to true.
DEBUG=true

in the .env file - Logs will be presented in the terminal window.

  • To disable debugging set env DEBUG=false in the .env file

The logging functions are handled by the debugUtility.js the four methods for debugging are

  • err
  • warn
  • debug
  • log

to include the debugUtility in your files place

const logger = require('brody_logger');

To use the looger throughout your code simple treat the logger as you would a

console.log()

Example:

//some code
logger.log('Message I want to send to the terminal or log file without any tag');
//some code
logger.debug('Message I want to send to terminal or log file with a debug flag');
//some code
logger.err('Message I want to send to terminal or log file with an err flag');
//some code
logger.warn('Message I want to send to terminal or log file with an warn flag')
 
logger.sys('Message I want to send to terminal or log file with an sys flag')
 // * The sys flag will prepend a timestamp to the message.

Colors for the individual flags can be modified in the debugUtility.js

Readme

Keywords

none

Package Sidebar

Install

npm i brody_logger

Weekly Downloads

13

Version

2.2.1

License

MIT

Last publish

Collaborators

  • brodifferus