Esempio n. 1
0
        private void Log(
            LogLevel level,
            string messageWithPii,
            string messageScrubbed)
        {
            if (level > Level)
            {
                return;
            }

            // format log message;
            string correlationId = CorrelationId.Equals(Guid.Empty) ? string.Empty : " - " + CorrelationId;

            bool messageWithPiiExists = !string.IsNullOrWhiteSpace(messageWithPii);
            // If we have a message with PII, and PII logging is enabled, use the PII message, else use the scrubbed message.
            bool   isLoggingPii = messageWithPiiExists && PiiLoggingEnabled;
            string messageToLog = isLoggingPii ? messageWithPii : messageScrubbed;

            string log = string.Format(
                CultureInfo.InvariantCulture,
                "{0} MSAL {1} {2} {3} [{4}{5}] {6}",
                isLoggingPii ? "(True)" : "(False)",
                _systemUtils.GetProductVersion(),
                _systemUtils.GetClientSku(), // todo: ensure this is the same as MSAL today...
                _systemUtils.GetOperatingSystem(),
                _timeService.GetUtcNow(),
                correlationId,
                messageToLog);

            _msalClientConfiguration.InvokeLoggerCallback(this, new LoggerCallbackEventArgs(isLoggingPii, level, log));
        }
Esempio n. 2
0
 private IDictionary <string, string> GetVersionHeaders()
 {
     return(new Dictionary <string, string>
     {
         [ServerHeaderKey.XClientSku] = _systemUtils.GetClientSku(),
         [ServerHeaderKey.XClientOs] = _systemUtils.GetOsVersion(),
         [ServerHeaderKey.XClientVer] = _systemUtils.GetProductVersion()
     });
 }