コード例 #1
0
ファイル: Log.cs プロジェクト: CeMSIM/CeMSIM-ORSim
        private void WriteLog(LogLevel level, string message)
        {
            if (!ShouldLog(level))
            {
                return;
            }

            string format;

            switch (level)
            {
            case LogLevel.Trace:
                format = _traceFormat;
                break;

            case LogLevel.Debug:
                format = _debugFormat;
                break;

            case LogLevel.Info:
            case LogLevel.Warn:
            case LogLevel.Error:
                format = _basicFormat;
                break;

            default:
                throw new ArgumentOutOfRangeException("level", level, null);
            }

            Logs.SendLogMessage(string.Format(format, DateTime.UtcNow, message), level);
        }
コード例 #2
0
        private void WriteLog(LogLevel level, string message)
        {
            if (!ShouldLog(level))
            {
                return;
            }

            var msg = string.Format(_format, message);

            switch (level)
            {
            case LogLevel.Trace:
                Logs.SendLogMessage(string.Format("TRACE {0}", msg), level);
                break;

            case LogLevel.Debug:
                Logs.SendLogMessage(string.Format("DEBUG {0}", msg), level);
                break;

            case LogLevel.Info:
            case LogLevel.Warn:
            case LogLevel.Error:
                Logs.SendLogMessage(msg, level);
                break;

            default:
                throw new ArgumentOutOfRangeException("level", level, null);
            }
        }