Socket
Socket
Sign inDemoInstall

electron-log

Package Overview
Dependencies
Maintainers
1
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-log - npm Package Compare versions

Comparing version 3.0.0-beta2 to 3.0.0-beta3

lib/catchErrors.js

3

CHANGELOG.md

@@ -11,2 +11,5 @@ # Changelog

- New feature: log file clearing.
- New feature: colors support.
- New feature: errors catching.
- Changed default format option for console transport.
- log-s transport is renamed to remote.

@@ -13,0 +16,0 @@

@@ -71,2 +71,7 @@ export type ILogLevel = "error" | "warn" | "info" | "verbose" | "debug" |

declare interface ICatchErrorsOptions {
showDialog?: boolean;
onError?(error: Error): void;
}
declare interface IElectronLog {

@@ -78,2 +83,4 @@ transports: ITransports;

catchErrors(options?: ICatchErrorsOptions): void;
error(...params: any[]): void;

@@ -93,2 +100,4 @@ warn(...params: any[]): void;

export declare function catchErrors(options?: ICatchErrorsOptions): void;
export declare function error(...params: any[]): void;

@@ -95,0 +104,0 @@ export declare function warn(...params: any[]): void;

'use strict';
var catchErrors = require('./lib/catchErrors');
var log = require('./lib/log');

@@ -7,7 +8,15 @@ var transportConsole = require('./lib/transports/console');

var transportRemote = require('./lib/transports/remote');
var transportMainConsole = require('./lib/transports/main-console');
var transportRendererConsole = require('./lib/transports/renderer-console');
var transportMainConsole = require('./lib/transports/mainConsole');
var transportRendererConsole = require('./lib/transports/rendererConsole');
var utils = require('./lib/utils');
module.exports = {
catchErrors: function callCatchErrors(options) {
var opts = Object.assign({}, {
log: module.exports.error,
showDialog: process.type === 'browser'
}, options || {});
catchErrors(opts);
},
hooks: [],

@@ -14,0 +23,0 @@ isDev: utils.isDev(),

2

lib/transports/file/index.js

@@ -7,3 +7,3 @@ 'use strict';

var format = require('../../format');
var findLogPath = require('./find-log-path');
var findLogPath = require('./findLogPath');

@@ -10,0 +10,0 @@ module.exports = fileTransportFactory;

@@ -19,6 +19,18 @@ 'use strict';

sendIpcToMain: sendIpcToMain,
sendIpcToRenderer: sendIpcToRenderer
sendIpcToRenderer: sendIpcToRenderer,
showErrorBox: showErrorBox
};
function getElectronApp() {
return getElectronModule('app');
}
function getElectronAppName() {
var app = getElectronApp();
if (!app) return null;
return app.getName();
}
function getElectronModule(name) {
if (!electron) {

@@ -28,8 +40,8 @@ return null;

if (electron.app) {
return electron.app;
if (electron[name]) {
return electron[name];
}
if (electron.remote) {
return electron.remote.app;
return electron.remote[name];
}

@@ -40,9 +52,2 @@

function getElectronAppName() {
var app = getElectronApp();
if (!app) return null;
return app.getName();
}
function getRemote() {

@@ -104,1 +109,8 @@ if (electron && electron.remote) {

}
function showErrorBox(title, message) {
var dialog = getElectronModule('dialog');
if (!dialog) return;
dialog.showErrorBox(title, message);
}
{
"name": "electron-log",
"version": "3.0.0-beta2",
"version": "3.0.0-beta3",
"description": "Just a very simple logging module for your Electron application",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,2 +18,7 @@ # electron-log

Documentation on this page is for v3.0.0 beta version, which will be released
in January. Documentation for v2.2.17 is
[here](https://github.com/megahertz/electron-log/tree/v2.2.17) and
[here is a migration guide](doc/migrate-v3.md).
## Installation

@@ -47,4 +52,7 @@

Transport is a simple function which does some work with log message.
By default, two transports are active: console and file.
By default, two transports are active: console and file.
If you change some transport options, make sure you apply the changes both in
main and renderer processes.
You can set transport options or use methods using:

@@ -137,2 +145,14 @@

### Catch errors
electron-log can catch and log unhandled errors/rejected promises:
`log.catchErrors(options = {})`;
##### Options
- **showDialog**, default true for the main process. Set it to false to prevent
showing a default electron error dialog
- **onError**, (error) => void, default null - attach a custom error handler
### [Hooks](doc/extend.md#hooks)

@@ -139,0 +159,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc