@ursif/logger

0.0.0 • Public • Published

ursif/logger

Overview

This is the default logger for all ursif modules. It uses console.log but also exposes a createLogger function which will use the provided function. logger uses createLogger(console.log) under the hood.

Log Format:

[PID]:[LEVEL]:[TIMESTAMP]:[title]:<message>

Interface

interface LogMessage {
    title?: string;
    message?: string;
}

type LogFn = (msg: LogMessage) => void;

interface Logger {
    debug: LogFn;
    info: LogFn;
    warn: LogFn;
    error: LogFn;
}

type LoggerFn = (str: string) => void;

Usage

logger.info({
    title: 'REST_START',
    message: `REST Service Started at http://localhost:${REST_SERVER_PORT}`
})
// [1416]:[INFO]:[1527533803898]:[REST_START]:REST Service Started at http://localhost:5001

logger.debug({
    title: 'REST_START',
    message: `REST Service Started at http://localhost:${REST_SERVER_PORT}`
})
// [1416]:[DEBUG]:[1527533803898]:[REST_START]:REST Service Started at http://localhost:5001

Readme

Keywords

none

Package Sidebar

Install

npm i @ursif/logger

Weekly Downloads

1

Version

0.0.0

License

MIT

Unpacked Size

3.62 kB

Total Files

3

Last publish

Collaborators

  • beardedtim