@geek/logger
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -101,4 +101,3 @@ 'use strict'; | ||
this[level_name] = async (message, params = {}) => { | ||
params = getLogParams(message, params, level_name); | ||
params = getLogLevelParams(level_name, message, params); | ||
const current_namespace = params.namespace || this.namespace; | ||
@@ -122,4 +121,5 @@ if (all_namespaces.get(current_namespace)) { | ||
if (parent) { | ||
this[level_name] = async params => { | ||
params = getLogParams(params); | ||
this[level_name] = async (message, params = {}) => { | ||
// params = getLogParams(params); | ||
params = getLogLevelParams(level_name, message, params); | ||
const current_namespace = params.namespace || this.namespace; | ||
@@ -147,3 +147,5 @@ if (all_namespaces.get(current_namespace)) { | ||
params = getLogParams(message, params, level_name); | ||
// params = getLogParams(message, params, level_name); | ||
params = getLogLevelParams(level_name, message, params); | ||
const current_namespace = params.namespace || this.namespace; | ||
@@ -163,3 +165,3 @@ if (all_namespaces.get(current_namespace)) { | ||
this.log = async (level, message, params = {}) => { | ||
params = getLogLevelParams(params); | ||
params = getLogLevelParams(level, message, params); | ||
const current_namespace = params.namespace || this.namespace; | ||
@@ -176,3 +178,3 @@ if (all_namespaces.get(current_namespace)) { | ||
this.log = async (level, message, params = {}) => { | ||
params = getLogLevelParams(params); | ||
params = getLogLevelParams(level, message, params); | ||
@@ -286,3 +288,3 @@ const current_namespace = params.namespace || this.namespace; | ||
const getLogParams = (message = '', params = {}) => { | ||
const getLogParams = (message, params = {}) => { | ||
@@ -292,2 +294,3 @@ if (typeof message === 'object') { | ||
params = checkForError(message); | ||
params.message = params.error_message; | ||
} else if (typeof message === 'string') { | ||
@@ -307,2 +310,3 @@ if (typeof params !== 'object') { | ||
return params; | ||
@@ -313,5 +317,8 @@ }; | ||
if (params instanceof Error) { | ||
const result = {}; | ||
result.stack = params.stack; | ||
// const result = JSON.parse(JSON.stringify(params)); | ||
const result = { ...params }; | ||
console.warn(result instanceof Error); | ||
result.stack_array = _.split(params.stack, '\n').filter(o => o); | ||
result.error_message = params.message; | ||
result.message = undefined; | ||
return result; | ||
@@ -334,3 +341,3 @@ } else { | ||
} else if (typeof message === 'object') { | ||
params = message; | ||
params = checkForError(message); | ||
} | ||
@@ -341,3 +348,3 @@ | ||
} else if (typeof level === 'object') { | ||
params = level; | ||
params = checkForError(level); | ||
} | ||
@@ -344,0 +351,0 @@ |
{ | ||
"name": "@geek/logger", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Logging module for Node.js and Axway Titanium", | ||
@@ -5,0 +5,0 @@ "main": "Logger.js", |
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
87024
897