custom-winston-logger
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Custom Winstom Logger

Provided transports

  • console
  • daily-rotate-file (combined, error)

Install

$ npm install custom-winston-logger

Usage

const { default: logger, setup } = require("custom-winston-logger");
setup({ some option...})
 
const log = logger('some-label');
log.info('...')
import logger, { setup } from 'custom-winston-logger';
setup({ some option...})
const log = logger('some-label');
log.info('...')

Options

export interface OptionsInterface {
  consoleColor: boolean; // whether use color in console log output or not
  disableFile: boolean; // whether disable file log or not
  level: "debug" | "info"; // default log level for combined log
  errorLogFileName: string; // error log file name
  combinedLogFileName: string; // combined log file name
  dailyRotateFileOptions: {
    dirname: string; // log directory
    datePattern: string;
    zippedArchive: boolean;
    maxSize: string;
    maxFiles: string;
  };
}
 
const options: OptionsInterface = {
  consoleColor: true,
  disableFile: false,
  level: "debug",
  errorLogFileName: "error-%DATE%.log",
  combinedLogFileName: "combined-%DATE%.log",
  dailyRotateFileOptions: {
    dirname: join(process.cwd(), "logs"),
    datePattern: "YYYY-MM-DD-HH",
    zippedArchive: true,
    maxSize: "20m",
    maxFiles: "14d",
  },
};

Readme

Keywords

none

Package Sidebar

Install

npm i custom-winston-logger

Weekly Downloads

1

Version

0.0.2

License

ISC

Unpacked Size

27.2 kB

Total Files

25

Last publish

Collaborators

  • 4000d