Consola Transport
Consola is an elegant and configurable console logger for Node.js and browser.
Important Notes
- The default log level is
3
which excludesdebug
andtrace
- 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
LogLayer | Consola |
---|---|
trace | trace |
debug | debug |
info | info |
warn | warn |
error | error |
fatal | fatal |