Skip to content

architelos/node-log-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-log-js


Tiny logging module. Inspired by npm/debug.

Contents

Installing

Using npm:

$ npm install @architelos/node-log-js

Usage

  • Import node-log-js:
import Logger from "@architelos/node-log-js";

// or

const Logger = require("@architelos/node-log-js");
  • Create a new Logger instance:
let logger = new Logger();
  • Create a new logger:
let logger = logger.Logger("worker", "37", "error");

Available parameters:

Name Type Description Default
loggerName string Name of the logger "logger"
loggerColor string ANSI color code of
the log message
"37"
loggerLevel string Name of the console
function. For example,
log, error, warn
"log"
  • Use the logger:
logger("Hello! I am some text!");
Additionally, the environment variable LOGGER_ALLOW can be set to a regex (or multiple regexes seperated by a ,) to allow/disallow loggers from logging.
On Windows (cmd):
$ set LOGGER_ALLOW=""
On Windows (powershell):
$ $env:LOGGER_ALLOW=""
On Linux (bash):
export LOGGER_ALLOW=""

Contributing

Open a pull request, or submit a new issue.

License

See license.

About

Tiny logging module. Inspired by npm/debug.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published