Skip to content

Consola Transport

NPM Version

Consola is an elegant and configurable console logger for Node.js and browser.

Transport Source

Important Notes

  • The default log level is 3 which excludes debug and trace
  • Set level to 5 to enable all log levels
  • Consola provides additional methods not available through LogLayer

Installation

Install the required packages:

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

Setup

typescript
import { createConsola } from 'consola'
import { LogLayer } from 'loglayer'
import { ConsolaTransport } from "@loglayer/transport-consola"

const log = new LogLayer({
  transport: new ConsolaTransport({
    logger: createConsola({
      level: 5  // Enable all log levels
    })
  })
})

Log Level Mapping

LogLayerConsola
tracetrace
debugdebug
infoinfo
warnwarn
errorerror
fatalfatal