@contrast/logger
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -85,6 +85,3 @@ "use strict"; | ||
}, | ||
serializers: { | ||
...pino_1.default.stdSerializers, | ||
...serializers, | ||
}, | ||
serializers, | ||
onChild(instance) { | ||
@@ -91,0 +88,0 @@ this[exports.kChildren].push(extend(instance, targets)); |
import { Config } from '@contrast/config'; | ||
export declare function config({ _effectiveMap, _status, ...rest }: Config): { | ||
import { AxiosRequestConfig, AxiosResponse } from 'axios'; | ||
/** | ||
* Excludes fields related to effective config since that is logged with | ||
* diagnostics enabled. Includes `_errors`. | ||
*/ | ||
export declare function config({ _effectiveMap, _status, ...config }: Config): { | ||
_filepath: string; | ||
@@ -120,2 +125,24 @@ _errors: Error[]; | ||
}; | ||
/** | ||
* Hides the `stdout` and `stderr` fields from child_process errors since they | ||
* are extremely verbose. | ||
*/ | ||
export declare const err: (err: Error) => Record<string, any>; | ||
/** | ||
* Serializes requests for the contrast-ui http logger. | ||
*/ | ||
export declare function req(config: AxiosRequestConfig): { | ||
id: any; | ||
method: string | undefined; | ||
url: string | undefined; | ||
data: any; | ||
contentLength: any; | ||
}; | ||
/** | ||
* Serializes response for the contrast-ui http logger. | ||
*/ | ||
export declare function res(response: AxiosResponse): { | ||
status: number; | ||
data: any; | ||
}; | ||
//# sourceMappingURL=serializers.d.ts.map |
@@ -17,9 +17,44 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.config = void 0; | ||
// exclude fields related to effective config since that is logged w/ diagnostics enabled | ||
// but do include _errors | ||
function config({ _effectiveMap, _status, ...rest }) { | ||
return rest; | ||
exports.res = exports.req = exports.err = exports.config = void 0; | ||
const pino_1 = require("pino"); | ||
/** | ||
* Excludes fields related to effective config since that is logged with | ||
* diagnostics enabled. Includes `_errors`. | ||
*/ | ||
function config({ _effectiveMap, _status, ...config }) { | ||
return config; | ||
} | ||
exports.config = config; | ||
/** | ||
* Hides the `stdout` and `stderr` fields from child_process errors since they | ||
* are extremely verbose. | ||
*/ | ||
exports.err = pino_1.stdSerializers.wrapErrorSerializer(({ stdout, stderr, ...err }) => err); | ||
/** | ||
* Serializes requests for the contrast-ui http logger. | ||
*/ | ||
function req(config) { | ||
return { | ||
id: Reflect.get(config, 'id'), | ||
method: config.method, | ||
url: config.url, | ||
// Since we log `req` data on both request and response events we don't want | ||
// to duplicate logging `data`, which is a JSON object when provided to the | ||
// request interceptor but a string within the `response.config` object. | ||
data: typeof config.data === 'object' ? config.data : undefined, | ||
contentLength: config.headers?.['Content-Length'] // only present on response.config | ||
}; | ||
} | ||
exports.req = req; | ||
/** | ||
* Serializes response for the contrast-ui http logger. | ||
*/ | ||
function res(response) { | ||
return { | ||
status: response.status, | ||
// If the response is empty, like from a 204 or 304, don't log "" | ||
data: response.data !== '' ? response.data : undefined, | ||
}; | ||
} | ||
exports.res = res; | ||
//# sourceMappingURL=serializers.js.map |
{ | ||
"name": "@contrast/logger", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Centralized logging for Contrast agent services", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE", |
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
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
27308
360