mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Optional PII logging (#11322)
* Start with logger * allow user to enable PII logging * prefix the log
This commit is contained in:
36
extensions/azurecore/src/utils/Logger.ts
Normal file
36
extensions/azurecore/src/utils/Logger.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user