electron-log
Advanced tools
Comparing version 5.1.4 to 5.1.5
{ | ||
"name": "electron-log", | ||
"version": "5.1.4", | ||
"version": "5.1.5", | ||
"description": "Just a simple logging module for your Electron application", | ||
@@ -22,5 +22,5 @@ "main": "src/index.js", | ||
"files": [ | ||
"src/*", | ||
"!**/__specs__", | ||
"!**/.*", | ||
"src/*", | ||
"main.js", | ||
@@ -27,0 +27,0 @@ "main.d.ts", |
@@ -265,2 +265,8 @@ import { ClientRequest, RequestOptions } from 'http'; | ||
/** | ||
* Override appName used for resolving log path | ||
* @param appName | ||
*/ | ||
setAppName(appName: string): void; | ||
/** | ||
* Whether to write a log file synchronously. Default to true | ||
@@ -267,0 +273,0 @@ */ |
@@ -24,3 +24,5 @@ 'use strict'; | ||
try { | ||
appName = this.electron.app?.name || this.electron.app?.getName(); | ||
appName = this.appName | ||
|| this.electron.app?.name | ||
|| this.electron.app?.getName(); | ||
} catch { | ||
@@ -27,0 +29,0 @@ // fallback to default value below |
@@ -24,3 +24,13 @@ 'use strict'; | ||
getAppName() { | ||
return this.appName || this.getAppPackageJson()?.name; | ||
const appName = this.appName || this.getAppPackageJson()?.name; | ||
if (!appName) { | ||
throw new Error( | ||
'electron-log can\'t determine the app name. It tried these methods:\n' | ||
+ '1. Use `electron.app.name`\n' | ||
+ '2. Use productName or name from the nearest package.json`\n' | ||
+ 'You can also set it through log.transports.file.setAppName()', | ||
); | ||
} | ||
return appName; | ||
} | ||
@@ -185,2 +195,6 @@ | ||
setAppName(appName) { | ||
this.appName = appName; | ||
} | ||
setPlatform(platform) { | ||
@@ -187,0 +201,0 @@ this.platform = platform; |
@@ -57,2 +57,6 @@ 'use strict'; | ||
}, | ||
setAppName(name) { | ||
logger.dependencies.externalApi.setAppName(name); | ||
}, | ||
}); | ||
@@ -59,0 +63,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12
91019
39
2909