gcp-structured-logger
Advanced tools
Comparing version
{ | ||
"name": "gcp-structured-logger", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Structured logger for GCP logging", | ||
@@ -35,3 +35,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@google-cloud/error-reporting": "^2.0.1" | ||
"@google-cloud/error-reporting": "^2.0.2" | ||
}, | ||
@@ -41,9 +41,9 @@ "devDependencies": { | ||
"chai": "^4.3.4", | ||
"eslint": "^7.24.0", | ||
"eslint": "^7.27.0", | ||
"eslint-plugin-mocha": "^8.1.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"mocha": "^8.3.2", | ||
"mocha": "^8.4.0", | ||
"nyc": "^15.1.0", | ||
"sinon": "^10.0.0" | ||
"sinon": "^11.0.0" | ||
} | ||
} |
@@ -47,7 +47,10 @@ const { format, formatWithOptions } = require('util') | ||
this._productionTransport = productionTransport | ||
/** @readonly @private */ | ||
/** @readonly @protected */ | ||
this._labels = Object.assign({ log_name: logName }, labels) | ||
} | ||
/** @param {string} type */ | ||
/** | ||
* @param {string} type | ||
* @returns {StructuredLogger} | ||
*/ | ||
child(type) { | ||
@@ -58,3 +61,3 @@ return new StructuredLogger(this._projectId, this._logName, this._errorReporter, this._productionTransport, { ...this._labels, type }) | ||
/** | ||
* @private | ||
* @protected | ||
* @param {import('express-serve-static-core').Request} request | ||
@@ -334,2 +337,12 @@ * @param {?import('../').ExtractUser} extractUser | ||
/** | ||
* @param {string} type | ||
* @returns {StructuredRequestLogger} | ||
*/ | ||
child(type) { | ||
const child = this._requestChild(this._request, this._extractUser) | ||
child._labels.type = type | ||
return child | ||
} | ||
/** | ||
* @param {import('@google-cloud/error-reporting').ErrorReporting} errorReporter | ||
@@ -336,0 +349,0 @@ * @param {any} err |
33795
0.83%730
1.67%