Files
vscode/extensions/microsoft-authentication/src/common/loggerOptions.ts
Tyler James Leonhardt da3cf78129 Enable the broker in macOS (#261148)
* Enable the broker in macOS

Fixes https://github.com/microsoft/vscode/issues/260158

* for testing

* better globbing

* guh

* guh

* delete

* log it all

* let's just log everything

* Only do on supported OS/Arches

* Add a console.log

* look at VSCODE_ARCH

* add msal files

* add entitlement maybe here

* actually it's probably here

* build: bundle msal libs for x64 and arm64

* revert that

* try again

* try adding $(AppIdentifierPrefix)

* temp: add debuggee entitlements

* bump msal and pass in redirect uri on macOS

* revert entitlement files

* forgot the .helper

* Allow PII for the output channel only

* use unsigned option

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-08-27 14:31:09 -07:00

65 lines
1.9 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { LogLevel as MsalLogLevel } from '@azure/msal-node';
import { env, LogLevel, LogOutputChannel } from 'vscode';
import { MicrosoftAuthenticationTelemetryReporter } from './telemetryReporter';
export class MsalLoggerOptions {
piiLoggingEnabled = false;
constructor(
private readonly _output: LogOutputChannel,
private readonly _telemtryReporter: MicrosoftAuthenticationTelemetryReporter
) { }
get logLevel(): MsalLogLevel {
return this._toMsalLogLevel(env.logLevel);
}
loggerCallback(level: MsalLogLevel, message: string, _containsPii: boolean): void {
// Log to output channel one level lower than the MSAL log level
switch (level) {
case MsalLogLevel.Error:
this._output.error(message);
this._telemtryReporter.sendTelemetryErrorEvent(message);
return;
case MsalLogLevel.Warning:
this._output.warn(message);
return;
case MsalLogLevel.Info:
this._output.debug(message);
return;
case MsalLogLevel.Verbose:
this._output.trace(message);
return;
case MsalLogLevel.Trace:
// Do not log trace messages
return;
default:
this._output.debug(message);
return;
}
}
private _toMsalLogLevel(logLevel: LogLevel): MsalLogLevel {
switch (logLevel) {
case LogLevel.Trace:
return MsalLogLevel.Trace;
case LogLevel.Debug:
return MsalLogLevel.Verbose;
case LogLevel.Info:
return MsalLogLevel.Info;
case LogLevel.Warning:
return MsalLogLevel.Warning;
case LogLevel.Error:
return MsalLogLevel.Error;
default:
return MsalLogLevel.Info;
}
}
}