void-logger
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

void-logger 2.0.0

void-logger is a Simple Logger written in javascript(NodeJS) with no dependencies.

installation

npm install void-logger@latest

How to use it

const { Logger } = require('void-logger');

// create a logger with these properties
let logger = Logger.create('.', {
    logName: 'logger',
    logFormat: '[type] [date] [time] [text]',
    dateFormat: '[year]/[day]/[month]',
    timeFormat:'[hours]:[minutes]:[seconds]',
    logToConsole:false
});

// clear the log
logger.clearLog();

// info message
logger.info('App has been updated!');

// error message
logger.error('Config not found!');

// warning message
logger.warning('You are using a deprecated method!');

Example config

let exampleConfig = {
    // name of the logger
    "logName": "logger",
    // [date] is the date formated
    // [text] is the text printed by the logger
    // [type] is the type of logging(info, error, warning)
    // [time] is the time formated
    "logFormat": "[type] [date] [time] [text]",

    // format for the date
    // [local_date] = Local Date.
    // [local] = Local date and time.
    // [year] = Year
    // [month] = Month
    // [day] = day
    // [time] = time
    "dateFormat": "[local]",

    // format for the time
    // [hours] is current hour
    // [minutes] is current minutes
    // [seconds] is current second
    // [milliseconds] is current milliseconds
    // [local_time] give the local time string
    "timeFormat": "[time]",

    // choose to log the message in the console or not
    logToConsole:false
};

Readme

Keywords

Package Sidebar

Install

npm i void-logger

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

10.3 kB

Total Files

6

Last publish

Collaborators

  • mrthomas20121