feat(logging): export redactLogLine function

Signed-off-by: Diego Bardari <diego.bardari@klarna.com>
This commit is contained in:
Diego Bardari
2022-07-19 10:35:21 +02:00
parent e657ae1f90
commit 1732a18a7a
4 changed files with 19 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-common': minor
---
Exported redactLogLine function to be able to use it in custom loggers.
+5
View File
@@ -568,6 +568,11 @@ export type ReadUrlResponseFactoryFromStreamOptions = {
etag?: string;
};
// @public
export function redactLogLine(
info: winston.Logform.TransformableInfo,
): winston.Logform.TransformableInfo;
// @public
export function requestLoggingHandler(logger?: Logger): RequestHandler;
+6 -1
View File
@@ -15,5 +15,10 @@
*/
export * from './formats';
export { createRootLogger, getRootLogger, setRootLogger } from './rootLogger';
export {
createRootLogger,
getRootLogger,
setRootLogger,
redactLogLine,
} from './rootLogger';
export * from './voidLogger';
@@ -69,8 +69,10 @@ export function setRootLoggerRedactionList(redactionList: string[]) {
/**
* A winston formatting function that finds occurrences of filteredKeys
* and replaces them with the corresponding identifier.
*
* @public
*/
function redactLogLine(info: winston.Logform.TransformableInfo) {
export function redactLogLine(info: winston.Logform.TransformableInfo) {
// TODO(hhogg): The logger is created before the config is loaded, because the
// logger is needed in the config loader. There is a risk of a secret being
// logged out during the config loading stage.