Skip to content

Winston Transport Browser Server

NPM Version

Winston A logger for just about everything.

Transport Source

Installation

Install the required packages:

sh
npm i loglayer @loglayer/transport-winston winston
sh
pnpm add loglayer @loglayer/transport-winston winston
sh
yarn add loglayer @loglayer/transport-winston winston

Setup

typescript
import winston from 'winston'
import { LogLayer } from 'loglayer'
import { WinstonTransport } from "@loglayer/transport-winston"

const w = winston.createLogger({})

const log = new LogLayer({
  transport: new WinstonTransport({
    logger: w
  })
})

Configuration Options

Required Parameters

None - all parameters are optional.

Optional Parameters

NameTypeDefaultDescription
level"trace" | "debug" | "info" | "warn" | "error" | "fatal""trace"Minimum log level to process. Messages with a lower priority level will be ignored
enabledbooleantrueIf false, the transport will not send any logs to the logger
consoleDebugbooleanfalseIf true, the transport will also log messages to the console for debugging
idstring-A unique identifier for the transport

Log Level Mapping

LogLayerWinston
tracesilly
debugdebug
infoinfo
warnwarn
errorerror
fatalerror

Changelog

View the changelog here.