0.1.0 • Published 2 years ago

rhyno v0.1.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

Installation

$ npm install rhyno --save

Usage

import { Logger, Level, Transport } from 'rhyno'

const logger = new Logger({
    transports: [
        new Transport({
            level: new Level({
                name: 'test',
                color: 'CYAN',
                format: '{{color}}[ {{prefix}} ] {{reset_color}}({{time}}) {{message}}',
                time: {
                    format: 'DD/MM/YYYY HH:mm:ss',
                    locale: 'es'
                }
            })
        })
    ]
})

logger.log({
    level: 'test',
    message: 'Hi, this is a test using Rhyno!'
})

The output will be:

[ test ] (19/02/2021 19:32) Hi, this a test using Rhyno!

Any format is allowed:

[ test ] (20/03/2022 15:23) Hi, this a test using Rhyno!

You can also log without date (first delete the placeholder on format):

[ test ] Hi, this a test using Rhyno!