+
Skip to content

arymoraes/lightlogging

Repository files navigation

Light Logging

GitHub

Description

A lightweight logging library for Node.js applications with optional colorization and file output.

Installation

npm install lightlogging

or with yarn:

yarn add lightlogging

Usage

import Log from "lightlogging";

Log.info("Server running at http://localhost:3000");
Log.warn("isSomeFunction is deprecated.");
Log.error("Failed to connect to database.");

Config

Log.configure({
  logFilePath: false, // You can passa a boolean, case true will create a folder log in root project, or pass the path of a folder that you want to create the folders and files for logs
  icons: true, // To show icons on logs '✔ ⚠️  X'
  customColors: {
    info: "green", // Colors can be any of the supported colors
    error: "magenta",
    warn: "cyan",
  },
  timestamps: "all", // "all", "log-only", "none"
});

Default configs are:

Log.configure({
  logFilePath: false, // No file output
  icons: false,
  customColors: {
    info: "white",
    error: "red",
    warn: "yellow",
  },
  timestamps: "log-only",
});

Supported Colors

  • black, red, green, yellow, blue, magenta, cyan, white, gray

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载