Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
electron-log-daedalus
Advanced tools
Just a very simple logging module for your Electron application
Just a simple logging module for your Electron or NW.js application. No dependencies. No complicated configuration. Just require and use. It can be used without Electron.
By default it writes logs to the following locations:
~/.config/<app name>/log.log
~/Library/Logs/<app name>/log.log
%USERPROFILE%\AppData\Roaming\<app name>\log.log
Install with npm:
npm install electron-log
var log = require('electron-log');
log.info('Hello, log');
If you would like to use electron-log in a renderer process only, you should require it in the main process too.
electron-log supports the following log levels:
error, warn, info, verbose, debug, silly
Transport is a simple function which requires an object which describes a message. By default, two transports are active: console and file.
Please be aware that the file log level is 'warn' by default, so info and debug messages won't be written to a log file.
The file path is dependent on the current platform.
Transport config is available only inside the main process.
log.transports.file.level = false;
log.transports.console.level = false;
var format = require('util');
log.transports.console = function(msg) {
var text = util.format.apply(util, msg.data);
console.log(`[${msg.date.toLocaleTimeString()} ${msg.level}] ${text}`);
};
Please be aware that if you override a transport function the default transport options (like level or format) will be undefined.
// Log level
log.transports.console.level = 'warn';
/**
* Set output format template. Available variables:
* Main: {level}, {text}
* Date: {y},{m},{d},{h},{i},{s},{ms},{z}
*/
log.transports.console.format = '{h}:{i}:{s}:{ms} {text}';
// Set a function which formats output
log.transports.console.format = (msg) => util.format.apply(util, msg.data);
Show logs in Chromium DevTools Console. It has the same options as console transport.
// Same as for console transport
log.transports.file.level = 'warn';
log.transports.file.format = '{h}:{i}:{s}:{ms} {text}';
// Set approximate maximum log size in bytes. When it exceeds,
// the archived log will be saved as the log.old.log file
log.transports.file.maxSize = 5 * 1024 * 1024;
// Set maximum log files count. When it exceeds,
// oldest old log file is deleted.
log.transports.file.maxItems = 4;
// Set timestamp format postfixed to log file.
log.transports.file.timeStampPostfixFormat = '{y}{m}{d}{h}{i}{s}';
// Write to this file, must be set before first logging
log.transports.file.file = __dirname + '/log.txt';
// fs.createWriteStream options, must be set before first logging
// you can find more information at
// https://nodejs.org/api/fs.html#fs_fs_createwritestream_path_options
log.transports.file.streamConfig = { flags: 'w' };
// set existed file stream
log.transports.file.stream = fs.createWriteStream('log.txt');
By default, file transport reads a productName or name property from
package.json to determine a log path like
~/.config/<app name>/log.log
. If you have no package.json or you want
to specify another path, just set the appName property:
log.transports.file.appName = 'test';
This value should be set before the first log method call.
Since version 2.0.0 this package works differently in main and renderer processes. When it's included in a renderer process it sends logs to the main process through IPC. There are no API changes, you can still require the package by the same way both in main and renderer processes, but please be aware that transport configuration is available only inside the main process.
2.2.20
2.2.19
2.2.18
.log
for the log rotation feature to work. Now it's possible to
use any file extension.2.1.0
2.0.0
electron .
or similar way)1.3.0
1.2.0
1.0.16
Licensed under MIT.
FAQs
Just a very simple logging module for your Electron application
The npm package electron-log-daedalus receives a total of 11 weekly downloads. As such, electron-log-daedalus popularity was classified as not popular.
We found that electron-log-daedalus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.