Comparing version 2.3.9 to 2.3.10-us449456-ecs-apm-winston.10
'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
exports.isDevelopment = exports.environment = void 0 | ||
exports.environment = | ||
@@ -4,0 +5,0 @@ (typeof process !== 'undefined' && process.env.NODE_ENV && process.env.NODE_ENV.trim()) || |
@@ -9,1 +9,2 @@ export declare const dumpError: (e: Error) => { | ||
}; | ||
export declare const getRaw: (e: Error) => string; |
'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
exports.getRaw = exports.dumpError = void 0 | ||
var serialize_error_1 = require('serialize-error') | ||
exports.dumpError = function(e) { | ||
@@ -9,6 +11,11 @@ return { | ||
callstack: e.stack, | ||
raw: JSON.stringify(e) | ||
raw: exports.getRaw(e) | ||
} | ||
} | ||
} | ||
exports.getRaw = function(e) { | ||
var result = JSON.stringify(serialize_error_1.serializeError(e)) | ||
// If we got a html page as an error content agreed cut it to not break the logging | ||
return result.length > 8000 ? result.substr(0, 8000) : result | ||
} | ||
//# sourceMappingURL=error.js.map |
'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
exports.customFormat = void 0 | ||
var ecsFormat = require('@elastic/ecs-winston-format') | ||
var util_1 = require('util') | ||
@@ -21,3 +23,3 @@ var winston_1 = require('winston') | ||
) | ||
: winston_1.format.combine(winston_1.format.timestamp(), winston_1.format.logstash()) | ||
: ecsFormat({}) | ||
//# sourceMappingURL=format.js.map |
'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
var logger_1 = require('./logger') | ||
exports.makeLogger = logger_1.makeLogger | ||
exports.wipeSensitiveData = logger_1.wipeSensitiveData | ||
Object.defineProperty(exports, 'makeLogger', { | ||
enumerable: true, | ||
get: function() { | ||
return logger_1.makeLogger | ||
} | ||
}) | ||
Object.defineProperty(exports, 'wipeSensitiveData', { | ||
enumerable: true, | ||
get: function() { | ||
return logger_1.wipeSensitiveData | ||
} | ||
}) | ||
var wrap_1 = require('./wrap') | ||
exports.wrapLogger = wrap_1.wrapLogger | ||
Object.defineProperty(exports, 'wrapLogger', { | ||
enumerable: true, | ||
get: function() { | ||
return wrap_1.wrapLogger | ||
} | ||
}) | ||
var error_1 = require('./error') | ||
exports.dumpError = error_1.dumpError | ||
Object.defineProperty(exports, 'dumpError', { | ||
enumerable: true, | ||
get: function() { | ||
return error_1.dumpError | ||
} | ||
}) | ||
//# sourceMappingURL=index.js.map |
@@ -17,2 +17,3 @@ 'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
exports.wipeSensitiveData = exports.makeLogger = void 0 | ||
var winston_1 = require('winston') | ||
@@ -23,3 +24,3 @@ var env_1 = require('./env') | ||
exports.makeLogger = function(customOptions) { | ||
var options = __assign({}, defaultOptions, customOptions) | ||
var options = __assign(__assign({}, defaultOptions), customOptions) | ||
var wipeSensitiveDataFormat = winston_1.format(function(meta) { | ||
@@ -43,3 +44,3 @@ return options.wipeSensitiveData(meta) | ||
if (msg instanceof Error) { | ||
logger[level](msg.name, __assign({}, meta, error_1.dumpError(msg))) | ||
logger[level](msg.name, __assign(__assign({}, meta), error_1.dumpError(msg))) | ||
} else if (meta instanceof Error) { | ||
@@ -46,0 +47,0 @@ logger[level](msg, error_1.dumpError(meta)) |
@@ -17,2 +17,3 @@ 'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
exports.wrapLogger = void 0 | ||
var error_1 = require('./error') | ||
@@ -23,8 +24,11 @@ exports.wrapLogger = function(logger, baseMeta, convertMeta) { | ||
if (msg instanceof Error) { | ||
logger[level](msg.message, __assign({}, defaultMeta, error_1.dumpError(msg))) | ||
logger[level](msg.message, __assign(__assign({}, defaultMeta), error_1.dumpError(msg))) | ||
} else if (meta instanceof Error) { | ||
logger[level](msg, __assign({}, defaultMeta, error_1.dumpError(meta))) | ||
logger[level](msg, __assign(__assign({}, defaultMeta), error_1.dumpError(meta))) | ||
return wrappedLogger | ||
} else if (meta) { | ||
logger[level](msg, __assign({}, defaultMeta, convertMeta ? convertMeta(meta) : meta)) | ||
logger[level]( | ||
msg, | ||
__assign(__assign({}, defaultMeta), convertMeta ? convertMeta(meta) : meta) | ||
) | ||
} else { | ||
@@ -31,0 +35,0 @@ logger[level](msg, defaultMeta) |
@@ -11,2 +11,6 @@ export declare const convertMeta: ({ snapshot, operation, service }: { | ||
} | undefined; | ||
}) => {}; | ||
}) => { | ||
service_name?: string; | ||
operation_id?: string; | ||
snapshot_id?: string; | ||
}; |
@@ -17,5 +17,7 @@ 'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
exports.convertMeta = void 0 | ||
// tslint:disable:no-unused-expression | ||
// tslint:disable-next-line:no-implicit-dependencies | ||
var chai_1 = require('chai') | ||
var error_1 = require('./error') | ||
var index_1 = require('./index') | ||
@@ -27,5 +29,6 @@ exports.convertMeta = function(_a) { | ||
return __assign( | ||
{}, | ||
snapshot ? { snapshot_id: snapshot.id } : undefined, | ||
operation ? { operation_id: operation.id } : undefined, | ||
__assign( | ||
__assign({}, snapshot ? { snapshot_id: snapshot.id } : undefined), | ||
operation ? { operation_id: operation.id } : undefined | ||
), | ||
service ? { service_name: service.name } : undefined | ||
@@ -133,3 +136,3 @@ ) | ||
name: 'Error', | ||
raw: '{}' | ||
raw: error_1.getRaw(error) | ||
} | ||
@@ -152,3 +155,3 @@ }) | ||
name: 'Error', | ||
raw: '{}' | ||
raw: error_1.getRaw(error) | ||
} | ||
@@ -172,3 +175,3 @@ }) | ||
name: 'Error', | ||
raw: '{}' | ||
raw: error_1.getRaw(error1) | ||
} | ||
@@ -197,3 +200,3 @@ }) | ||
name: 'Error', | ||
raw: '{}' | ||
raw: error_1.getRaw(error) | ||
} | ||
@@ -220,3 +223,3 @@ }) | ||
name: 'Error', | ||
raw: '{}' | ||
raw: error_1.getRaw(error) | ||
} | ||
@@ -244,3 +247,3 @@ }) | ||
name: 'Error', | ||
raw: '{}' | ||
raw: error_1.getRaw(error1) | ||
} | ||
@@ -250,3 +253,14 @@ }) | ||
}) | ||
describe('should properly handle circular dependencies', function() { | ||
it('circular error thrown - error serialized', function() { | ||
var _a = makeLoggerStub(), | ||
logger = _a.logger, | ||
result = _a.result | ||
var error = new Error('error') | ||
error.cicleRef = error | ||
logger.error(error, error) | ||
chai_1.expect(result.error[0].meta.message).eq(error.message) | ||
}) | ||
}) | ||
}) | ||
//# sourceMappingURL=wrap.spec.js.map |
{ | ||
"name": "loggerism", | ||
"version": "2.3.9", | ||
"version": "2.3.10-us449456-ecs-apm-winston.10", | ||
"description": "Yet another logger abstraction", | ||
@@ -25,3 +25,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"winston": "^3.1.0" | ||
"@elastic/ecs-winston-format": "^1.3.1", | ||
"serialize-error": "^5.0.0", | ||
"winston": "^3.6.0" | ||
}, | ||
@@ -31,3 +33,3 @@ "devDependencies": { | ||
"@types/mocha": "^5.2.5", | ||
"@types/node": "^10.12.18", | ||
"@types/node": "^10.17.60", | ||
"chai": "^4.2.0", | ||
@@ -41,3 +43,3 @@ "mocha": "^5.2.0", | ||
"tslint-config-prettier": "^1.17.0", | ||
"typescript": "^3.2.4" | ||
"typescript": "^3.9.10" | ||
}, | ||
@@ -44,0 +46,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
31950
512
3
2
+ Addedserialize-error@^5.0.0
+ Added@elastic/ecs-helpers@2.1.1(transitive)
+ Added@elastic/ecs-winston-format@1.5.3(transitive)
+ Addedserialize-error@5.0.0(transitive)
+ Addedtype-fest@0.8.1(transitive)
Updatedwinston@^3.6.0