Files
plane/packages/logger
Aaron 553f01fde1 feat: migrate to pnpm from yarn (#7593)
* chore(repo): migrate to pnpm

* chore(repo): cleanup pnpm integration with turbo

* chore(repo): run lint

* chore(repo): cleanup tsconfigs

* chore: align TypeScript to 5.8.3 across monorepo; update pnpm override and catalog; pnpm install to update lockfile

* chore(repo): revert logger.ts changes

* fix: type errors

* fix: build errors

* fix: pnpm home setup in dockerfiles

---------

Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
2025-08-19 20:06:42 +05:30
..
2025-07-25 01:44:51 +05:30

Logger Package

This package provides a logger and a request logger utility built using Winston. It offers customizable log levels using env and supports structured logging for general application logs and HTTP requests.

Features.

  • Dynamic log level configuration using env.
  • Pre-configured winston logger for general usage (logger).
  • Request logger middleware that logs incoming request

Usage

Adding as a package

Add this package as a dependency in package.json

dependency: {
    ...
    @plane/logger":"*",
    ...
}

Importing the Logger

import { logger, requestLogger } from "@plane/logger";

Usage

logger: General Logger

Use this for general application logs.

logger.info("This is an info log");
logger.warn("This is a warning");
logger.error("This is an error");

requestLogger: Request Logger Middleware

Use this as a middleware for incoming requests

const app = express();
app.use(requestLogger);

Available Log Levels

  • error
  • warn
  • info (default)
  • http
  • verbose
  • debug
  • silly

Log file

  • Log files are stored in logs folder of current working directory. Error logs are stored in files with format error-%DATE%.log and combined logs are stored with format combined-%DATE%.log.
  • Log files have a 7 day rotation period defined.

Configuration

  • By default, the log level is set to info.
  • You can specify a log level by adding a LOG_LEVEL in .env.