1.0.0 • Published 7 months ago

electron-winston v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

electron-winston

Simple logger for Electron app based on Winston.

!TIP The default write location for log files via the Electron app.getPath('log') API.

  • on Linux: ~/.config/{app name}/logs/log.log
  • on macOS: ~/Library/Logs/{app name}/log.log
  • on Windows: %USERPROFILE%\AppData\Roaming\{app name}\logs\log.log

Install

$ npm install electron-winston

Usage

Using in Electron Main Process

import { Logger } from 'electron-winston/main'

const logger = new Logger()

logger.info('hello world')

Using in Electron Renderer Process

  1. Register a listener in main process, so that you can use it in the renderer process.
import { Logger } from 'electron-winston/main'

const logger = new Logger()

logger.registerRendererListener()
  1. Expose the Logger API.

You can expose it in the specified preload script:

import { exposeLogger } from 'electron-winston/preload'

exposeLogger()

Or, you can expose it globally in the main process for all renderer processes:

import { useLogger } from 'electron-winston/main'

useLogger()
  1. Use it in the renderer process
import logger from 'electron-winston/renderer'

logger.info('hello world')

License

MIT copyright © 2024-present alex wei

1.0.0

7 months ago

1.0.0-beta.3

7 months ago

1.0.0-beta.2

8 months ago

1.0.0-beta.1

8 months ago

1.0.0-beta.0

8 months ago