Skip to content

nephelaiio/node-logger

Repository files navigation

@nephelaiio/logger

Custom log utilities built on top of Winston for Node.js.

License: MIT

Table of Contents

Installation

Install the package using npm:

npm install @nephelaiio/logger

Usage

Initialization

First, initialize the logger by specifying the logging level and optionally some initial messages.

import { init } from "@nephelaiio/logger";

init(level, "info");

Logging

You can log messages at different levels using the utility methods.

import { debug, info, warn, error } from "@nephelaiio/logger";

debug("This is a debug message.");
info("This is an informational message.");
warn("This is a warning.");
error("This is an error.");

API

  • init(level: LogLevels, messages?: Messages, transports?: Transport[]): Initialize logger.
  • setInfo(msgs?: Messages): Set logging level to 'info'.
  • setVerbose(msgs?: Messages): Set logging level to 'debug'.
  • setWarn(msgs?: Messages): Set logging level to 'warn'.
  • setQuiet(msgs?: Messages): Set logging level to 'error'.
  • debug(message: string): Log a debug message.
  • info(message: string): Log an informational message.
  • warn(message: string): Log a warning message.
  • error(message: string): Log an error message.

Contributing

We welcome contributions! See CONTRIBUTING.md for details.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Issues

Please feel free to submit issues and enhancement requests here.