@kingdanx/litelogger

1.1.0 • Public • Published

LiteLogger

Usage

For use in Nodejs to create daily logs with time stamps for your application.

To use:

Install the NPM package:

npm i @kingdanx/litelogger

Create a new LiteLogger object:

const logger = new LiteLogger(__dirname, "Test Dir", "Test Logs");
//The first argument is the name of the directory. 
//The second argument is the name of the folder you want your files in. It will be created if it does not exist
//The third argument is the name attached to the .log files

This logger object would create a directory and files that look like this:
image

Call the log() method:

logger.log({ test: "test" }, "ERROR");
logger.log("test");
//The first argument is the message you want to log.
//The second argument is a string value that defines the message type. If not provided it will be of type INFO

Here is the expected output from the above code:
image

If the log() function is called on a day for which no log file exists, a new file will be created to store all messages received on that day. If log() is called on a day that already has an associated file, the message will be appended to that file.

Readme

Keywords

none

Package Sidebar

Install

npm i @kingdanx/litelogger

Weekly Downloads

2

Version

1.1.0

License

ISC

Unpacked Size

8.83 kB

Total Files

8

Last publish

Collaborators

  • kingdanx