Exemple #1
0
        void SendReport(ReportTo destination, LogLevel level, object message, Exception exception)
        {
            if (destination.HasFlag(ReportTo.Log))
            {
                try
                {
                    if (_logClient != null)
                    {
                        _logClient.Send(Formatter.Format(level, message, exception));
                    }
                    else
                    {
                        switch (level)
                        {
                        case LogLevel.Fatal: _log.Fatal(message, exception); break;

                        case LogLevel.Error: _log.Error(message, exception); break;

                        case LogLevel.Warning: _log.Warn(message, exception); break;

                        case LogLevel.Info: _log.Info(message, exception); break;

                        case LogLevel.Debug: _log.Debug(message, exception); break;
                        }
                    }
                }
                catch (Exception e)
                {
                    LoggingFailed(e);
                }
            }

            if (destination.HasFlag(ReportTo.User))
            {
                if (level == LogLevel.Error || level == LogLevel.Fatal)
                {
                    Console.Error.WriteLine(message);
                }
                else
                {
                    Console.Out.WriteLine(message);
                }
            }
        }
Exemple #2
0
 public void Debug(object o, ReportTo destination = ReportTo.Log)
 {
 }
Exemple #3
0
 public void Info(object o, ReportTo destination = ReportTo.Log)
 {
 }
Exemple #4
0
 public void Warn(object o, ReportTo destination = ReportTo.Log)
 {
 }
Exemple #5
0
 public void Exception(object o, Exception e, ReportTo destination = ReportTo.Log)
 {
 }
Exemple #6
0
 public void Error(object o, ReportTo destination = ReportTo.Log)
 {
 }
Exemple #7
0
 public void Fatal(object o, Exception exception = null, ReportTo destination = ReportTo.Log)
 {
 }
        public static void Trace(this IReport report, object o, ReportTo destination = ReportTo.Log)
        {
#if TRACE_NETWORK
            report.Info(o, destination);
#endif
        }
Exemple #9
0
 public void Debug(object o, ReportTo destination = ReportTo.Log)
 {
     SendReport(destination, LogLevel.Debug, o, null);
 }
Exemple #10
0
 public void Info(object o, ReportTo destination = ReportTo.Log)
 {
     SendReport(destination, LogLevel.Info, o, null);
 }
Exemple #11
0
 public void Warn(object o, ReportTo destination = ReportTo.Log)
 {
     SendReport(destination, LogLevel.Warning, o, null);
 }
Exemple #12
0
 public void Exception(object o, Exception e, ReportTo destination = ReportTo.Log)
 {
     SendReport(destination, LogLevel.Error, o, e);
 }
Exemple #13
0
 public void Error(object o, ReportTo destination = ReportTo.Log)
 {
     SendReport(destination, LogLevel.Error, o, null);
 }
Exemple #14
0
 public void Fatal(object o, Exception exception = null, ReportTo destination = ReportTo.Log)
 {
     SendReport(destination, LogLevel.Fatal, o, exception);
 }