Пример #1
0
        /// <inheritdoc />
        public void Log(LogLevel level, string data)
        {
            switch (level)
            {
            case LogLevel.Warning:
                this.Log().Warn(data);
                break;

            case LogLevel.Error:
                this.Log().Error(data);
                break;

            case LogLevel.Information:
                this.Log().Info(data);
                break;

            case LogLevel.Debug:
                this.Log().Debug(data);
                break;

            default:
                this.Log().Info(data);
                break;
            }
        }
        private LogLevel MapLevel(NuGetLogLevel level)
        {
            switch (level)
            {
            case NuGetLogLevel.Debug:
                return(LogLevel.Debug);

            case NuGetLogLevel.Verbose:
                return(LogLevel.Debug);

            case NuGetLogLevel.Information:
                return(LogLevel.Info);

            case NuGetLogLevel.Minimal:
                return(LogLevel.Info);

            case NuGetLogLevel.Warning:
                return(LogLevel.Warning);

            case NuGetLogLevel.Error:
                return(LogLevel.Error);

            default:
                throw Ensure.Exception.NotSupported(level);
            }
        }
Пример #3
0
        public void Log(LogLevel level, string data)
        {
            Microsoft.Extensions.Logging.LogLevel mslevel;
            switch (level)
            {
            case LogLevel.Debug:
                mslevel = Microsoft.Extensions.Logging.LogLevel.Debug;
                break;

            case LogLevel.Verbose:
                mslevel = Microsoft.Extensions.Logging.LogLevel.Debug;
                break;

            case LogLevel.Information:
                mslevel = Microsoft.Extensions.Logging.LogLevel.Information;
                break;

            case LogLevel.Minimal:
                mslevel = Microsoft.Extensions.Logging.LogLevel.Warning;
                break;

            case LogLevel.Warning:
                mslevel = Microsoft.Extensions.Logging.LogLevel.Warning;
                break;

            case LogLevel.Error:
                mslevel = Microsoft.Extensions.Logging.LogLevel.Error;
                break;

            default:
                mslevel = Microsoft.Extensions.Logging.LogLevel.Debug;
                break;
            }
            _logger.Log(mslevel, data);
        }
Пример #4
0
        /// <summary>
        /// Genric log at level
        /// </summary>
        /// <param name="level"></param>
        /// <param name="data"></param>
        public void Log(NuGetCommon.LogLevel level, string data)
        {
            switch (level)
            {
            case NuGetCommon.LogLevel.Debug:
                LogDebug(data);
                break;

            case NuGetCommon.LogLevel.Verbose:
                LogVerbose(data);
                break;

            case NuGetCommon.LogLevel.Information:
                LogInformation(data);
                break;

            case NuGetCommon.LogLevel.Warning:
                LogWarning(data);
                break;

            case NuGetCommon.LogLevel.Error:
                LogError(data);
                break;

            default:
                LogMinimal(data);
                break;
            }
        }
Пример #5
0
        private static Microsoft.Extensions.Logging.LogLevel GetLogLevel(LogLevel logLevel)
        {
            switch (logLevel)
            {
            case LogLevel.Debug:
                return(Microsoft.Extensions.Logging.LogLevel.Debug);

            case LogLevel.Verbose:
                return(Microsoft.Extensions.Logging.LogLevel.Trace);

            case LogLevel.Information:
                return(Microsoft.Extensions.Logging.LogLevel.Information);

            case LogLevel.Minimal:
                return(Microsoft.Extensions.Logging.LogLevel.Information);

            case LogLevel.Warning:
                return(Microsoft.Extensions.Logging.LogLevel.Warning);

            case LogLevel.Error:
                return(Microsoft.Extensions.Logging.LogLevel.Error);

            default:
                throw new ArgumentOutOfRangeException(nameof(logLevel), logLevel, null);
            }
        }
Пример #6
0
        static Microsoft.Extensions.Logging.LogLevel ConvertLevel(LogLevel level)
        {
            switch (level)
            {
            case LogLevel.Debug:
                return(Microsoft.Extensions.Logging.LogLevel.Debug);

            case LogLevel.Verbose:
                return(Microsoft.Extensions.Logging.LogLevel.Trace);

            case LogLevel.Information:
                return(Microsoft.Extensions.Logging.LogLevel.Information);

            case LogLevel.Minimal:
                return(Microsoft.Extensions.Logging.LogLevel.Information);

            case LogLevel.Warning:
                return(Microsoft.Extensions.Logging.LogLevel.Warning);

            case LogLevel.Error:
                return(Microsoft.Extensions.Logging.LogLevel.Error);

            default:
                return(Microsoft.Extensions.Logging.LogLevel.Information);
            }
        }
Пример #7
0
 private static Microsoft.Extensions.Logging.LogLevel GetLogLevel(LogLevel logLevel)
 {
     return(logLevel switch
     {
         LogLevel.Debug => Microsoft.Extensions.Logging.LogLevel.Debug,
         LogLevel.Verbose => Microsoft.Extensions.Logging.LogLevel.Trace,
         LogLevel.Information => Microsoft.Extensions.Logging.LogLevel.Information,
         LogLevel.Minimal => Microsoft.Extensions.Logging.LogLevel.Information,
         LogLevel.Warning => Microsoft.Extensions.Logging.LogLevel.Warning,
         LogLevel.Error => Microsoft.Extensions.Logging.LogLevel.Error,
         _ => throw new ArgumentOutOfRangeException(nameof(logLevel), logLevel, null),
     });
Пример #8
0
        static Microsoft.Extensions.Logging.LogLevel ConvertLevel(LogLevel level)
        {
            return(level switch
            {
                LogLevel.Debug => Microsoft.Extensions.Logging.LogLevel.Debug,
                LogLevel.Verbose => Microsoft.Extensions.Logging.LogLevel.Trace,
                LogLevel.Information => Microsoft.Extensions.Logging.LogLevel.Information,
                LogLevel.Minimal => Microsoft.Extensions.Logging.LogLevel.Information,
                LogLevel.Warning => Microsoft.Extensions.Logging.LogLevel.Warning,
                LogLevel.Error => Microsoft.Extensions.Logging.LogLevel.Error,

                _ => Microsoft.Extensions.Logging.LogLevel.Information,
            });
Пример #9
0
        private static Core.Diagnostics.LogLevel GetLogLevel(LogLevel logLevel)
        {
            switch (logLevel)
            {
            case LogLevel.Minimal:
                return(Core.Diagnostics.LogLevel.Information);

            case LogLevel.Warning:
                return(Core.Diagnostics.LogLevel.Warning);

            case LogLevel.Error:
                return(Core.Diagnostics.LogLevel.Error);

            default:
                return(Core.Diagnostics.LogLevel.Debug);
            }
        }
Пример #10
0
        private static Verbosity GetVerbosity(LogLevel logLevel)
        {
            switch (logLevel)
            {
            case LogLevel.Debug:
            case LogLevel.Verbose:
                return(Verbosity.Diagnostic);

            case LogLevel.Warning:
                return(Verbosity.Minimal);

            case LogLevel.Error:
                return(Verbosity.Quiet);

            default:
                return(Verbosity.Normal);
            }
        }
        static ScriptingStyle ToScriptStyle(NuGet.Common.LogLevel level)
        {
            switch (level)
            {
            case NuGet.Common.LogLevel.Debug:
            case NuGet.Common.LogLevel.Minimal:
            case NuGet.Common.LogLevel.Verbose:
                return(ScriptingStyle.Debug);

            case NuGet.Common.LogLevel.Error:
                return(ScriptingStyle.Error);

            case NuGet.Common.LogLevel.Information:
                return(ScriptingStyle.Out);

            case NuGet.Common.LogLevel.Warning:
                return(ScriptingStyle.Warning);

            default:
                return(ScriptingStyle.Out);
            }
        }
Пример #12
0
 public Task LogAsync(NuGet.Common.LogLevel level, string data)
 {
     return(Task.CompletedTask);
 }
Пример #13
0
 public void Log(NuGet.Common.LogLevel level, string data)
 {
 }
Пример #14
0
 public Task LogAsync(LogLevel level, string data)
 {
     return(Task.Run(() => Log(level, data)));
 }
Пример #15
0
 public void Log(LogLevel level, string data)
 {
     _logger.Log((Microsoft.Extensions.Logging.LogLevel)level, data);
 }
Пример #16
0
 public void Log(LogLevel level, string data) => _log.Write(GetVerbosity(level), GetLogLevel(level), data);
Пример #17
0
 public void Log(NuGet.Common.LogLevel level, string data)
 {
     lock (_lock) _ctx.Information($"NuGet ({level}): {data}");
 }
 void NuGet.Common.ILogger.Log(NuGet.Common.LogLevel level, string data)
 {
 }
Пример #19
0
 public void Log(LogLevel level, string data) => _logger.Log(_logLevelMap[level], 0, data, null, (s, _) => s);
Пример #20
0
 public void Log(LogLevel level, string data) => Log(new LogMessage(level, data));
 public void Log(NuGetLogLevel level, string data)
 {
     log.Log(MapLevel(level), data);
 }
Пример #22
0
 public Task LogAsync(NuGet.Common.LogLevel level, string data)
 {
     Log(level, data);
     return(System.Threading.Tasks.Task.CompletedTask);
 }
Пример #23
0
 public Task LogAsync(LogLevel level, string data)
 {
     Log(level, data);
     return(Task.CompletedTask);
 }
 public async Task LogAsync(NuGet.Common.LogLevel level, string data)
 {
 }