https://github.com/jpoon/winston-console-for-electron
:notebook_with_decorative_cover: Winston console transport for Electron applications
https://github.com/jpoon/winston-console-for-electron
electron winston winston-transport
Last synced: 2 months ago
JSON representation
:notebook_with_decorative_cover: Winston console transport for Electron applications
- Host: GitHub
- URL: https://github.com/jpoon/winston-console-for-electron
- Owner: jpoon
- License: mit
- Created: 2018-06-06T23:09:15.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-13T04:37:12.000Z (over 5 years ago)
- Last Synced: 2025-03-03T07:18:42.718Z (3 months ago)
- Topics: electron, winston, winston-transport
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/winston-console-for-electron
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://badge.fury.io/js/winston-console-for-electron)
# winston-console-for-electron
A modified version of Winston's [Console Transport](https://github.com/winstonjs/winston/blob/master/docs/transports.md#console-transport) to support Electron applications. Created mainly for use in [VSCodeVim](https://github.com/vscodevim/vim), an extension for VSCode, but it's generic enough to be used for other Electron applications.
## Installation
```
npm i --save winston-console-for-electron
```## Usage
* Requires winston > 3.0
```
import * as winston from 'winston';
import { ConsoleForElectron } from 'winston-console-for-electron';let logger = winston.createLogger({
transports: [new ConsoleForElectron()],
});
```## Options
* __level:__ Level of messages that this transport should log (default 'info').
* __silent:__ Boolean flag indicating whether to suppress output (default false).
* __colorize:__ Boolean flag indicating if we should colorize output (default false).
* __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps.
* __json:__ Boolean flag indicating whether or not the output should be JSON. If true, will log out multi-line JSON objects. (default false)
* __stringify:__ Boolean flag indiciating if the output should be passed through JSON.stringify, resulting in single-line output. Most useful when used in conjunction with the json flag. (default false)
* __prettyPrint:__ Boolean flag indicating if we should `util.inspect` the meta (default false). If function is specified, its return value will be the string representing the meta.
* __depth__ Numeric indicating how many times to recurse while formatting the object with `util.inspect` (only used with `prettyPrint: true`) (default null, unlimited)
* __showLevel:__ Boolean flag indicating if we should prepend output with level (default true).
* __formatter:__ If function is specified, its return value will be used instead of default output. (default undefined)
* __stderrLevels:__ Array of strings containing the levels to log to stderr instead of stdout, for example `['error', 'debug', 'info']`. (default `['error', 'debug']`)
* __prefix:__ Prefix to log## Inspirations/Alternatives
* https://github.com/dustinblackman/winston-electron - does not support Winston 3.0
* https://www.npmjs.com/package/winston-electron-console - looked sketchy; source code is nowhere to be found