Functions
Const formatJSON
Parameters
Returns Transducer<LogEntry, string>
Const formatString
Parameters
Returns Transducer<LogEntry, string>
Const isoDate
- isoDate(dt: number): string
Const maskSecrets
- maskSecrets(patterns: RegExp[], mask?: string): Transducer<string, string>
Parameters
patterns: RegExp[]
Default value mask: string = "****"
Returns Transducer<string, string>
Takes an array of regex patterns and optional
mask
string. Returns transducer which replaces all found pattern occurrences withmask
. Intended to be used in combination / after formatString to avoid leaking of sensitive information via logged messages.logger.transform( formatString(), maskSecrets([/(?<=[A-Z0-9_]\=)\w+/g]) ).subscribe( writeConsole() ); logger.info("logged in USER=toxi, using TOKEN=123456"); // [INFO] logger-0: logged in USER=****, using TOKEN=****