New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-tiny-logger

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-tiny-logger

A very tiny nodejs logger

1.0.0
latest
Source
npm
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

tiny-logger

Build Status

A very tiny logger for nodejs

Installation

npm install --save node-tiny-logger

Usage

import Logger from 'node-tiny-logger'
const logger = new Logger({
    level: Logger.INFO
})
logger.warn('some warning', {someObject: 1}, ...)

Logger Options

{
    level: Logger.FATAL | Logger.ERROR | Logger.WARN  | Logger.INFO  | Logger.DEBUG | Logger.TRACE,
    handleLogEntry?: (levelStr: string, argsPassedToLog),
    stream?: NodeJS.WritableStream
}

level:
All logs below this level will be ignored. Eg: If you specify Logger.WARN, then log.error() will work, but log.info() will be ignored

handleLogEntry(levelStr: string, argsPassedToLog):
Optional log entry handler. If you provide it then logs will trigger options.handleLogEntry function instead of writing to options.stream (or process.stdout). Eg:

const logger = new Logger({
    handleLogEntry: function(levelStr, args) {
        console.log(levelStr, args)
    }
})
logger.error("a", 1, 2); // => ERROR [ 'a', 1, 2 ]

stream:
If provided (and handleLogEntry is not provided) then it will be used to write log. Defaults to process.stdout

Keywords

nodejs logger

FAQs

Package last updated on 26 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts