All Projects → sindresorhus → Electron Timber

sindresorhus / Electron Timber

Licence: mit
Pretty logger for Electron apps

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Electron Timber

Quill
Asynchronous Low Latency C++ Logging Library
Stars: ✭ 422 (+25.22%)
Mutual labels:  logging, logger, logging-library
Tslog
📝 tslog - Expressive TypeScript Logger for Node.js.
Stars: ✭ 321 (-4.75%)
Mutual labels:  logging, logger, logging-library
Izumi
Productivity-oriented collection of lightweight fancy stuff for Scala toolchain
Stars: ✭ 423 (+25.52%)
Mutual labels:  logging, logger, logging-library
Cocoadebug
iOS Debugging Tool 🚀
Stars: ✭ 3,769 (+1018.4%)
Mutual labels:  logging, logger, logging-library
Timber Elixir
🌲 Great Elixir logging made easy
Stars: ✭ 226 (-32.94%)
Mutual labels:  logging, logger, logging-library
loggin-js
📝 Customizable and expandable logger for Node.js
Stars: ✭ 20 (-94.07%)
Mutual labels:  logger, logging-library
winston-telegram
A Telegram transport for winston
Stars: ✭ 28 (-91.69%)
Mutual labels:  logger, logging-library
Go Logger
Simple logger for Go programs. Allows custom formats for messages.
Stars: ✭ 261 (-22.55%)
Mutual labels:  logger, logging-library
Easyloggingpp
Single header C++ logging library. It is extremely powerful, extendable, light-weight, fast performing, thread and type safe and consists of many built-in features. It provides ability to write logs in your own customized format. It also provide support for logging your classes, third-party libraries, STL and third-party containers etc.
Stars: ✭ 3,032 (+799.7%)
Mutual labels:  logging, logging-library
use-reducer-logger
A very basic logger for the useReducer function in the React Hooks API.
Stars: ✭ 89 (-73.59%)
Mutual labels:  logger, logging-library
Woodlot
An all-in-one JSON logging utility that supports ExpressJS HTTP logging, custom logging, provides multi-format output and an easy to use events API.
Stars: ✭ 263 (-21.96%)
Mutual labels:  logger, logging-library
Tty Logger
A readable, structured and beautiful logging for the terminal
Stars: ✭ 280 (-16.91%)
Mutual labels:  logging, logger
Lighty
Easy to use and lightweight logger for iOS, macOS, tvOS, watchOS and Linux in Swift.
Stars: ✭ 49 (-85.46%)
Mutual labels:  logger, logging-library
moesif-nodejs
Moesif Nodejs Middleware Library (formerly Moesif-Express)
Stars: ✭ 36 (-89.32%)
Mutual labels:  logger, logging-library
gxlog
A concise, functional, flexible and extensible logger for go.
Stars: ✭ 65 (-80.71%)
Mutual labels:  logger, logging
chronica
Logger framework for Erlang applications
Stars: ✭ 57 (-83.09%)
Mutual labels:  logger, logging-library
Pygogo
A Python logging library with superpowers
Stars: ✭ 265 (-21.36%)
Mutual labels:  logging, logger
Log4qt
Log4Qt - Logging for the Qt cross-platform application framework
Stars: ✭ 292 (-13.35%)
Mutual labels:  logging, logging-library
Scribe
The fastest logging library in the world. Built from scratch in Scala and programmatically configurable.
Stars: ✭ 304 (-9.79%)
Mutual labels:  logging, logging-library
Analog
PHP logging library that is highly extendable and simple to use.
Stars: ✭ 314 (-6.82%)
Mutual labels:  logging, logger

electron-timber

Pretty logger for Electron apps

By default, logs from the renderer process don't show up in the terminal. Now they do.

You can use this module directly in both the main and renderer process.

Install

$ npm install electron-timber

Requires Electron 5 or later.

Usage

Main process:

const {app, BrowserWindow} = require('electron');
const logger = require('electron-timber');

let mainWindow;

(async () => {
	await app.whenReady();

	mainWindow = new BrowserWindow();
	await mainWindow.loadURL();

	logger.log('Main log');
	logger.error('Main error');

	const customLogger = logger.create({name: 'custom'});
	customLogger.log('Custom log');
})();

Renderer process:

const logger = require('electron-timber');

logger.log('Renderer log');
logger.error('Renderer error');

API

logger

Logging will be prefixed with either main or renderer depending on where it comes from.

Logs from the renderer process only show up if you have required electron-timber in the main process.

The methods are bound to the class instance, so you can do: const log = logger.log; log('Foo');.

log(…values)

Like console.log.

warn(…values)

Like console.warn.

error(…values)

Like console.error.

time(label)

Like console.time.

timeEnd(label)

Like console.timeEnd.

streamLog(stream)

Log each line in a stream.Readable. For example, child_process.spawn(…).stdout.

streamWarn(stream)

Same as streamLog, but logs using console.warn instead.

streamError(stream)

Same as streamLog, but logs using console.error instead.

create([options])

Create a custom logger instance.

You should initialize this on module load so prefix padding is consistent with the other loggers.

options

Type: object

name

Type: string

Name of the logger. Used to prefix the log output. Don't use main or renderer.

ignore

Type RegExp

Ignore lines matching the given regex.

logLevel

Type: string

Can be info (log everything), warn (log warnings and errors), or error (log errors only). Defaults to info during development and warn in production.

getDefaults()

Gets the default options (across main and renderer processes).

setDefaults([options]) Main process only

Sets the default options (across main and renderer processes).

options

Type: object

Same as the options for create().

Toggle loggers

You can show the output of only a subset of the loggers using the environment variable TIMBER_LOGGERS. Here we show the output of the default renderer logger and a custom unicorn logger, but not the default main logger:

TIMBER_LOGGERS=renderer,unicorn electron .

Related

Maintainers

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].