Beispiel #1
0
        public void Write(string message, LogLevel logLevel)
        {
            switch (logLevel)
            {
            default:
            case LogLevel.Debug:
                _logger.Log(NLog.LogLevel.Debug, message);
                break;

            case LogLevel.Info:
                _logger.Log(NLog.LogLevel.Info, message);
                break;

            case LogLevel.Warn:
                _logger.Log(NLog.LogLevel.Warn, message);
                break;

            case LogLevel.Error:
                _logger.Log(NLog.LogLevel.Error, message);
                break;

            case LogLevel.Fatal:
                _logger.Log(NLog.LogLevel.Fatal, message);
                break;
            }
        }
Beispiel #2
0
        public void Write(string message, Splat.LogLevel logLevel)
        {
            if (logLevel < Level)
            {
                return;
            }

            lock (gate) inner.WriteLine(message);
        }
        private static global::NLog.LogLevel RxUitoNLogLevel(LogLevel logLevel)
        {
            var mappings = new[]
            {
                new Tuple <LogLevel, global::NLog.LogLevel>(LogLevel.Debug, global::NLog.LogLevel.Debug),
                new Tuple <LogLevel, global::NLog.LogLevel>(LogLevel.Info, global::NLog.LogLevel.Info),
                new Tuple <LogLevel, global::NLog.LogLevel>(LogLevel.Warn, global::NLog.LogLevel.Warn),
                new Tuple <LogLevel, global::NLog.LogLevel>(LogLevel.Error, global::NLog.LogLevel.Error),
                new Tuple <LogLevel, global::NLog.LogLevel>(LogLevel.Fatal, global::NLog.LogLevel.Fatal)
            };

            return(mappings.First(x => x.Item1 == logLevel).Item2);
        }
Beispiel #4
0
 public void Write(string message, Splat.LogLevel logLevel)
 {
     lock (_mutex)
     {
         using (var stream = new FileStream(_path, FileMode.Open,
                                            System.Security.AccessControl.FileSystemRights.AppendData,
                                            FileShare.Write, 4096, FileOptions.None))
             using (var writer = new StreamWriter(stream))
             {
                 writer.WriteLine("{0}: {1}", logLevel.ToString().ToUpperInvariant(), message);
                 writer.Flush();
             }
     }
 }
Beispiel #5
0
        private static NLog.LogLevel NLogLogLevelToSplatLogLevel(LogLevel logLevel)
        {
            switch (logLevel)
            {
                case LogLevel.Debug:
                    return NLog.LogLevel.Debug;

                case LogLevel.Error:
                    return NLog.LogLevel.Error;

                case LogLevel.Fatal:
                    return NLog.LogLevel.Fatal;

                case LogLevel.Info:
                    return NLog.LogLevel.Info;

                case LogLevel.Warn:
                    return NLog.LogLevel.Warn;
            }

            throw new NotImplementedException("LogLevel isn't implemented");
        }
Beispiel #6
0
 public void Write(string message, LogLevel logLevel)
 {
     logger.Log(NLogLogLevelToSplatLogLevel(logLevel), message);
 }
Beispiel #7
0
 public void Write(string message, LogLevel logLevel)
 {
     logger.Log(NLogLogLevelToSplatLogLevel(logLevel), message);
 }
 /// <summary>
 /// Writes a message at the specified log level
 /// </summary>
 /// <param name="message">The message to write.</param>
 /// <param name="logLevel">The log level to write the message at.</param>
 public void Write(String message, LogLevel logLevel)
 {
     this._inner.Log(RxUitoNLogLevel(logLevel), message);
 }