1.17.0 • Published 5 years ago

personalized-logger v1.17.0

Weekly downloads
18
License
ISC
Repository
-
Last release
5 years ago

Personalized Logger

It is personalized method to Log messages in both console and file. The first version contemplates a simple idea of logging using the below formatting:

timestamp - Level - SubLevel - Machine Hostname - Process ID - Conversation ID: content

Levels

  • SYSTEM - It contemplates how the system works;
  • ENDPOINT - It contemplates the health of the application endpoints when it receive requests and send responses;
  • BUSINESS - It contemplates the business rules in the application;

Sublevels

It contemplates what kind of information exists in each Level.

  • INFO;
  • WARN;
  • ERROR;

How to use Personalized Logger

First step - Installing:

npm i --save personalized-logger

Second step - Adding the component:

const Logger = require("personalized-logger");

or

import Logger from "personalized-logger";

Third step - Using in application:

Logger.system(`${conversationID}`, `${contentMessage}`, `${subLevel}`);
/*
* this is a simple example using SYSTEM level logging but in all levels function 
* the same parameter are used
*/

How to call each level of log

Each level logging is represented by a function with the name of the level, in the above example, we used SYSTEM as a level but you can do with the other ones like the below examples:

Logger.endpoint(`${conversationID}`, `${contentMessage}`, `${subLevel}`);

or

Logger.business(`${conversationID}`, `${contentMessage}`, `${subLevel}`);

All functions receive the same three parameters:

  • conversationID - The ID of the conversation that is currently using our application;
  • contentMessage - A message defined by the user (DEV) to define the context of the log itself;
  • subLevel - The default sublevels listed before, the default sublevel is INFO;
1.17.0

5 years ago

1.16.0

5 years ago

1.15.0

5 years ago

1.14.0

5 years ago

1.12.0

5 years ago

1.11.0

5 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago