Optional PII logging (#11322)

* Start with logger

* allow user to enable PII logging

* prefix the log
This commit is contained in:
Amir Omidi
2020-07-13 13:05:00 -07:00
committed by GitHub
parent 347c193455
commit ff979f90d1
7 changed files with 86 additions and 25 deletions

View File

@@ -0,0 +1,36 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export class Logger {
private static _piiLogging: boolean = false;
static log(msg: any, ...vals: any[]) {
if (vals && vals.length > 0) {
return console.log(msg, vals);
}
console.log(msg);
}
static error(msg: any, ...vals: any[]) {
if (vals && vals.length > 0) {
return console.error(msg, vals);
}
console.error(msg);
}
static pii(msg: any, ...vals: any[]) {
if (this.piiLogging) {
Logger.log(msg, vals);
}
}
public static set piiLogging(val: boolean) {
this._piiLogging = val;
}
public static get piiLogging(): boolean {
return this._piiLogging;
}
}