1.0.2 • Published 2 years ago

@shippify/module-logger v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Logger Shippify

This module allows you to generate logs professionally, selecting the messages that are kept in production logger.info() or those that are used only during development logger.debug() or logger.trace()

.

Install

npm install @shippify/shippify-modules

.

Environment variable

This variable can determine the level of log that is written:

TRACE: all messages are written.

DEBUG: all messages are written except those of type trace.

INFO: messages of the type trace and debug are omitted

.

example .env file:

LOG_LEVEL=TRACE

.

Use in simple javascript:

const { Logger } = require("@shippify/shippify-modules/packages/logger");

const logger = new Logger('Simple ExampleJS');

logger.trace("example for simple javascript")
logger.debug("example for simple javascript")
logger.info("example for simple javascript")
logger.error("example for simple javascript")
logger.fatal("example for simple javascript")

.

Use in classes in javascript or typescript

Javascript example:

const { Logger } = require("@shippify/shippify-modules/packages/logger");

class Example {

    
    constructor() {
        this.logger = new Logger('ExampleJS')
    }

    execute() {
        this.logger.debug("example for javascript")
    }
}

const example = new Example();
example.execute();

.

Typescript example:

import { Logger } from '@shippify/shippify-modules/packages/logger'

export class Example {
    logger: Logger;

    constructor() {
        this.logger = new Logger('ExampleTS')
    }

    execute() {
        this.logger.debug("example for typescript")
    }
}


const example = new Example();
example.execute();

.

Based on log4js

This feature uses log4js. For More information consult the documentation

.

standardized, beautiful and colorful messages

DATABASECHANGELOG.png