Skip to content

Electron-log Transport

NPM Version

Electron-log is a logging library designed specifically for Electron applications.

Transport Source

Installation

Install the required packages:

sh
npm i loglayer @loglayer/transport-electron-log electron-log
sh
pnpm add loglayer @loglayer/transport-electron-log electron-log
sh
yarn add loglayer @loglayer/transport-electron-log electron-log

Setup

typescript
// Main process logger
import log from 'electron-log/src/main'
// Or for Renderer process
// import log from 'electron-log/src/renderer'
import { LogLayer } from 'loglayer'
import { ElectronLogTransport } from "@loglayer/transport-electron-log"

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

Log Level Mapping

LogLayerElectron-log
tracesilly
debugdebug
infoinfo
warnwarn
errorerror
fatalerror