@architelos/node-log-js

1.0.1 • Public • Published

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.

Package Sidebar

Install

npm i @architelos/node-log-js

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

7.49 kB

Total Files

8

Last publish

Collaborators

  • architelos