electron-log
Advanced tools
Comparing version 4.2.4 to 4.3.0
# Changelog | ||
## 4.3.0 | ||
- Add `transport.file.inspectOptions` | ||
- `transport.file.depth` is deprecated | ||
## 4.2.3 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "electron-log", | ||
"version": "4.2.4", | ||
"version": "4.3.0", | ||
"description": "Just a very simple logging module for your Electron application", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -1,2 +0,3 @@ | ||
import { RequestOptions } from "http"; | ||
import { RequestOptions } from 'http'; | ||
import { InspectOptions } from 'util'; | ||
@@ -200,2 +201,4 @@ declare namespace ElectronLog { | ||
* How deep to serialize complex objects | ||
* Deprecated in favor of inspectOptions | ||
* @deprecated | ||
*/ | ||
@@ -230,2 +233,8 @@ depth: number; | ||
/** | ||
* Serialization options | ||
* @link https://nodejs.org/api/util.html#util_util_inspect_object_options | ||
*/ | ||
inspectOptions: InspectOptions; | ||
/** | ||
* Maximum size of log file in bytes, 1048576 (1mb) by default. When a log | ||
@@ -232,0 +241,0 @@ * file exceeds this limit, it will be moved to log.old.log file and the |
@@ -37,6 +37,6 @@ 'use strict'; | ||
var cache = []; | ||
this.add = function (value) { cache.push(value) }; | ||
this.has = function (value) { return cache.indexOf(value) !== -1 }; | ||
return this; | ||
return { | ||
add: function (value) { cache.push(value) }, | ||
has: function (value) { return cache.indexOf(value) !== -1 }, | ||
}; | ||
} | ||
@@ -50,4 +50,4 @@ | ||
if (depth < 1) { | ||
if (data.map) return '[array]'; | ||
if (typeof data === 'object') return '[object]'; | ||
if (isArray(data)) return '[array]'; | ||
if (typeof data === 'object' && data) return '[object]'; | ||
@@ -57,3 +57,3 @@ return data; | ||
if (typeof data.map === 'function') { | ||
if (isArray(data)) { | ||
return data.map(function (child) { | ||
@@ -122,5 +122,3 @@ return maxDepth(child, depth - 1); | ||
function toStringFactory(depth) { | ||
depth = depth || 5; | ||
function toStringFactory(inspectOptions) { | ||
return function toStringFunction(data) { | ||
@@ -141,3 +139,3 @@ var simplifiedData = data.map(function (item) { | ||
if (util.formatWithOptions) { | ||
simplifiedData.unshift({ depth: depth }); | ||
simplifiedData.unshift(inspectOptions || {}); | ||
return util.formatWithOptions.apply(util, simplifiedData); | ||
@@ -149,1 +147,5 @@ } | ||
} | ||
function isArray(value) { | ||
return Object.prototype.toString.call(value) === '[object Array]'; | ||
} |
@@ -43,2 +43,3 @@ 'use strict'; | ||
}; | ||
transport.inspectOptions = {}; | ||
@@ -61,2 +62,6 @@ initDeprecated(); | ||
var scopeOptions = electronLog.scope.getOptions(); | ||
var inspectOptions = Object.assign( | ||
{ depth: transport.depth }, | ||
transport.inspectOptions | ||
); | ||
var content = transform.transform(message, [ | ||
@@ -66,3 +71,3 @@ transform.removeStyles, | ||
transform.concatFirstStringElements, | ||
transform.toStringFactory(transport.depth), | ||
transform.toStringFactory(inspectOptions), | ||
]); | ||
@@ -69,0 +74,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
65679
1990