Exemplo n.º 1
0
        /// <summary>
        /// Log using with metadata for non mono platforms.
        /// </summary>
        private void LogForNonMono(INuGetLogMessage message)
        {
            switch (message.Level)
            {
            case LogLevel.Error:
                LogError(message, _taskLogging.LogError, _taskLogging.LogError);
                break;

            case LogLevel.Warning:
                LogError(message, _taskLogging.LogWarning, _taskLogging.LogWarning);
                break;

            case LogLevel.Minimal:
                LogMessage(message, MessageImportance.High, _taskLogging.LogMessage, _taskLogging.LogMessage);
                break;

            case LogLevel.Information:
                LogMessage(message, MessageImportance.Normal, _taskLogging.LogMessage, _taskLogging.LogMessage);
                break;

            case LogLevel.Debug:
            case LogLevel.Verbose:
            default:
                // Default to LogLevel.Debug and low importance
                LogMessage(message, MessageImportance.Low, _taskLogging.LogMessage, _taskLogging.LogMessage);
                break;
            }
        }
Exemplo n.º 2
0
 private void LogError(INuGetLogMessage logMessage,
                       LogErrorWithDetails logWithDetails,
                       LogErrorAsString logAsString)
 {
     if (logMessage.Code > NuGetLogCode.Undefined)
     {
         // NuGet does not currently have a subcategory while throwing logs, hence string.Empty
         logWithDetails(string.Empty,
                        Enum.GetName(typeof(NuGetLogCode), logMessage.Code),
                        Enum.GetName(typeof(NuGetLogCode), logMessage.Code),
                        logMessage.FilePath,
                        logMessage.StartLineNumber,
                        logMessage.StartColumnNumber,
                        logMessage.EndLineNumber,
                        logMessage.EndColumnNumber,
                        logMessage.Message);
     }
     else
     {
         logAsString(logMessage.Message);
     }
 }