Skip to content

Alex-Werner/hermodlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hermodlog

npm version

Stupid simple logging for JS but with context for heavy log environments.

This is just to only pass along a single logger instance between modules and have a hierarchical way to sort and display such modules.

image

Install

npm i hermodlog

Usage

import Logger from 'hermodlog';

logger = new Logger();
logger.log("Stuff");


contextLogger = logger.context('Node#4');

moduleLogger = contextLogger.module('myModule');

API

Logger

new Logger(options)

Create a new logger instance.

context(name)

Create a new context logger with the given name.

module(name)

Create a new module logger with the given name.

log(message, level)

Log a message with the given level.

debug(message)

Log a message with the debug level.

info(message)

Log a message with the info level.

warn(message)

Log a message with the warn level.

error(message)

Log a message with the error level.

fatal(message)

Log a message with the fatal level.

License

MIT

About

Simple contextual logger to simplify log display in heavy load context and provide easy parsing

Resources

License

Stars

Watchers

Forks

Packages

No packages published