@lskjs/log
Advanced tools
Comparing version 2.64.1 to 2.65.0
{ | ||
"name": "@lskjs/log", | ||
"version": "2.64.1", | ||
"version": "2.65.0", | ||
"description": "Логгер совмещающий лучшие черты debug, bunyan, logfmt/logrus, morgan/winston, ", | ||
@@ -55,3 +55,3 @@ "keywords": [], | ||
}, | ||
"gitHead": "d9c716c50c2bc5c2798df875fdbfe8b86cf6d27e" | ||
"gitHead": "f2c87233d5dccf3fb60600408810abd2f980d89b" | ||
} |
@@ -24,9 +24,24 @@ "use strict"; | ||
var prettyRawLog = function prettyRawLog(log, raw) { | ||
var json = (0, _tryJSONparse.tryJSONparse)(raw); | ||
var json; | ||
var format; | ||
if (!json && !!raw.trim()) { | ||
json = (0, _tryLogfmtParse.tryLogfmtParse)(raw); | ||
if (typeof raw === 'string') { | ||
if (!json && !!raw.trim()) { | ||
json = (0, _tryJSONparse.tryJSONparse)(raw, null); | ||
format = 'json'; | ||
} | ||
if (!json && !!raw.trim()) { | ||
json = (0, _tryLogfmtParse.tryLogfmtParse)(raw, null); | ||
format = 'logfmt'; | ||
} | ||
} | ||
if (!json) { | ||
json = null; // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
format = 'raw'; | ||
} | ||
if (!json) { | ||
log.log.apply(log, (0, _toConsumableArray2["default"])((0, _prettyFormat.prettyFormat)({}, raw))); | ||
@@ -33,0 +48,0 @@ return; |
@@ -16,3 +16,9 @@ "use strict"; | ||
if (!str.trim()) return defaultValue; | ||
return logfmt.parse(str); | ||
var res = logfmt.parse(str); | ||
if (!Object.keys(res).length || Object.keys(res).length === 1 && Object.values(res)[0] === true) { | ||
return defaultValue; | ||
} | ||
return res; | ||
} catch (err) { | ||
@@ -19,0 +25,0 @@ return defaultValue; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
269788
2486