Merge pull request #12718 from Charge71/master
feat(logging): export redactLogLine function
This commit is contained in:
@@ -15,5 +15,10 @@
|
||||
*/
|
||||
|
||||
export * from './formats';
|
||||
export { createRootLogger, getRootLogger, setRootLogger } from './rootLogger';
|
||||
export {
|
||||
createRootLogger,
|
||||
getRootLogger,
|
||||
setRootLogger,
|
||||
redactWinstonLogLine,
|
||||
} 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 redactWinstonLogLine(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.
|
||||
@@ -104,7 +106,7 @@ export function createRootLogger(
|
||||
{
|
||||
level: env.LOG_LEVEL || 'info',
|
||||
format: winston.format.combine(
|
||||
winston.format(redactLogLine)(),
|
||||
winston.format(redactWinstonLogLine)(),
|
||||
env.NODE_ENV === 'production' ? winston.format.json() : coloredFormat,
|
||||
),
|
||||
defaultMeta: {
|
||||
|
||||
Reference in New Issue
Block a user