electron-log
Advanced tools
Comparing version 4.4.4 to 4.4.5
{ | ||
"name": "electron-log", | ||
"version": "4.4.4", | ||
"version": "4.4.5", | ||
"description": "Just a very simple logging module for your Electron application", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -40,3 +40,5 @@ 'use strict'; | ||
it('should serialize map', function () { | ||
expect(object.serialize(null, new Map([['a', 1]]))).toEqual({ a: 1 }); | ||
if (Object.fromEntries) { | ||
expect(object.serialize(null, new Map([['a', 1]]))).toEqual({ a: 1 }); | ||
} | ||
}); | ||
@@ -43,0 +45,0 @@ }); |
@@ -147,8 +147,10 @@ 'use strict'; | ||
var str = JSON.stringify(item, createSerializer(), ' '); | ||
if (str === undefined) { | ||
return undefined; | ||
try { | ||
var str = JSON.stringify(item, createSerializer(), ' '); | ||
return str === undefined ? undefined : JSON.parse(str); | ||
} catch (e) { | ||
// There are some rare cases when an item can't be simplified. | ||
// In that case, it's fine to pass it to util.format directly. | ||
return item; | ||
} | ||
return JSON.parse(str); | ||
}); | ||
@@ -155,0 +157,0 @@ |
@@ -18,2 +18,3 @@ 'use strict'; | ||
return tryReadJsonAt(require.main && require.main.filename) | ||
|| tryReadJsonAt(extractPathFromArgs()) | ||
|| tryReadJsonAt(process.resourcesPath, 'app.asar') | ||
@@ -30,2 +31,6 @@ || tryReadJsonAt(process.resourcesPath, 'app') | ||
function tryReadJsonAt(searchPath) { | ||
if (!searchPath) { | ||
return null; | ||
} | ||
try { | ||
@@ -79,1 +84,18 @@ searchPath = path.join.apply(path, arguments); | ||
} | ||
/** | ||
* Get app path from --user-data-dir cmd arg, passed to a renderer process | ||
* @return {string|null} | ||
*/ | ||
function extractPathFromArgs() { | ||
var matchedArgs = process.argv.filter(function (arg) { | ||
return arg.indexOf('--user-data-dir=') === 0; | ||
}); | ||
if (matchedArgs.length === 0 || typeof matchedArgs[0] !== 'string') { | ||
return null; | ||
} | ||
var userDataDir = matchedArgs[0]; | ||
return userDataDir.replace('--user-data-dir=', ''); | ||
} |
@@ -82,2 +82,7 @@ 'use strict'; | ||
if (!name) { | ||
// Fallback, otherwise file transport can't be initialized | ||
name = 'Electron'; | ||
} | ||
return { name: name, version: version }; | ||
@@ -84,0 +89,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
103351
3117