Beispiel #1
0
 public static void Verbose(string msg)
 {
     if (level == 0)
     {
         log.Write(Serilog.Events.LogEventLevel.Verbose, msg);
         if (useConsole)
         {
             Console.WriteLine($"[Verbose] {msg}");
         }
     }
 }
Beispiel #2
0
 /// <summary>Logs a message.</summary>
 public void Log(string message, LogLevel logLevel)
 {
     if (logLevel < _minLogLevel || message.ContainsAny(_hardExclusions))
     {
         return;
     }
     _logger.Write((LogEventLevel)logLevel, message);
 }
Beispiel #3
0
        public void Log(string sawmillName, LogEvent message)
        {
            var valid = _sLogger.BindProperty(LogManager.SawmillProperty, sawmillName, false, out var sawmillProperty);

            if (valid)
            {
                message.AddOrUpdateProperty(sawmillProperty);
            }

            _sLogger.Write(message);
        }
Beispiel #4
0
        /// <summary>
        /// Outputs the log.
        /// </summary>
        /// <param name="level">log level</param>
        /// <param name="message">message</param>
        /// <param name="className">Caller class name</param>
        /// <param name="method">Caller method name</param>
        private void outputLog(LogEventLevel level, string message, string className, string method)
        {
            var assembly   = Assembly.GetEntryAssembly();
            var moduleName = "UnknownModule";

            if (assembly != null)
            {
                moduleName = Path.GetFileNameWithoutExtension(assembly.Location);
            }

            var logFmt = $"{moduleName},{message},{className},{method}";

            fileLogger.Write(level, logFmt);
        }
Beispiel #5
0
 public void LogMessage(LogEventLevel logLevel, string message)
 {
     _logger.Write(logLevel, message);
     LogReceived?.Invoke(logLevel, _logger, message, _application);
 }
 public void Debug(string message) => _logger.Write(LogEventLevel.Error, message);