当前位置: 首页>>代码示例>>C#>>正文


C# LogSeverity类代码示例

本文整理汇总了C#中LogSeverity的典型用法代码示例。如果您正苦于以下问题:C# LogSeverity类的具体用法?C# LogSeverity怎么用?C# LogSeverity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LogSeverity类属于命名空间,在下文中一共展示了LogSeverity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StoryLogEntry

 public StoryLogEntry(LogSeverity severity, string text, TimeSpan elapsed)
 {
     this.severity = severity;
     this.text = text;
     this.elapsed = elapsed;
     this.dateTime = DateTime.UtcNow;
 }
开发者ID:amitapl,项目名称:logmetry,代码行数:7,代码来源:StoryLogEntry.cs

示例2: LogImpl

        protected override void LogImpl(LogSeverity severity, string message, ExceptionData exceptionData)
        {
            StringBuilder fullMessage = new StringBuilder();
            fullMessage.Append(GetCaption(severity));
            fullMessage.Append(": ");
            fullMessage.Append(message);

            if (exceptionData != null)
                fullMessage.Append('\n').Append(exceptionData);

            switch (severity)
            {
                case LogSeverity.Debug:
                    facadeLogger.LogMessage(fullMessage.ToString());
                    break;
                case LogSeverity.Info:
                case LogSeverity.Important:
                case LogSeverity.Warning:
                    facadeLogger.LogMessage(fullMessage.ToString());
                    break;
                case LogSeverity.Error:
                    facadeLogger.LogError(fullMessage.ToString());
                    break;
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:25,代码来源:FacadeLoggerWrapper.cs

示例3: LogImpl

        protected override void LogImpl(LogSeverity severity, string message, ExceptionData exceptionData)
        {
            if (severity < MinLogSeverity || LogMessage == null)
                return;

            Color color = Color.Black;
            switch (severity)
            {
                case LogSeverity.Error:
                    color = Color.Red;
                    break;

                case LogSeverity.Warning:
                    color = Color.Gold;
                    break;

                case LogSeverity.Important:
                    color = Color.Black;
                    break;

                case LogSeverity.Info:
                    color = Color.Gray;
                    break;

                case LogSeverity.Debug:
                    color = Color.DarkGray;
                    break;
            }

            LogMessage(this, new RuntimeLogEventArgs(message, color));

            if (exceptionData != null)
                LogMessage(this, new RuntimeLogEventArgs(exceptionData.ToString(), color));
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:34,代码来源:RuntimeLogger.cs

示例4: Log

 public void Log(string message, LogSeverity severity, Exception exception)
 {
     LastMessageSeverity = severity;
     LastMessage = message;
     LastException = exception;
     MessagesReceived++;
 }
开发者ID:csdahlberg,项目名称:bond,代码行数:7,代码来源:LoggerTests.cs

示例5: LogImpl

        protected override void LogImpl(LogSeverity severity, string message, ExceptionData exceptionData)
        {
            if (exceptionData != null)
                message += "\n" + exceptionData;

            switch (severity)
            {
                case LogSeverity.Error:
                    task.Log(Level.Error, message);
                    break;

                case LogSeverity.Warning:
                    task.Log(Level.Warning, message);
                    break;

                case LogSeverity.Important:
                    task.Log(Level.Info, message);
                    break;

                case LogSeverity.Info:
                    task.Log(Level.Verbose, message);
                    break;

                case LogSeverity.Debug:
                    task.Log(Level.Debug, message);
                    break;
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:28,代码来源:TaskLogger.cs

示例6: SpellbookLoggerEventArgs

 public SpellbookLoggerEventArgs(string message, object source, Exception exception, LogSeverity severity)
 {
     Message = message;
     Source = source;
     Exception = exception;
     Severity = severity;
 }
开发者ID:webba,项目名称:WurmAssistant2,代码行数:7,代码来源:SpellbookLogger.cs

示例7: Log

		/// <summary>
		/// Logs the specified severity.
		/// </summary>
		/// <param name="severity">The severity.</param>
		/// <param name="message">The message.</param>
		public void Log(LogSeverity severity, string message)
		{
			RequiresNotNull(message);
			var con = factory.OpenConnection();
			con.ContinueWith(pt =>
			{
				var connection = pt.Result;
				try
				{
					var cmd = connection.CreateCommand();
					cmd.CommandText = "INSERT INTO Log (Id, Timestamp, Severity, Message) VALUES (NEWID(), @time, @sev, @msg)";

					var timestampParameter = cmd.CreateParameter();
					timestampParameter.ParameterName = "@time";
					timestampParameter.Value = DateTime.Now;
					cmd.Parameters.Add(timestampParameter);

					var severityParameter = cmd.CreateParameter();
					severityParameter.ParameterName = "@sev";
					severityParameter.Value = severity.ToString();
					cmd.Parameters.Add(severityParameter);

					var messageParameter = cmd.CreateParameter();
					messageParameter.ParameterName = "@msg";
					messageParameter.Value = message;
					cmd.Parameters.Add(messageParameter);

					cmd.ExecuteNonQuery();
				}
				finally
				{
					connection.Dispose();
				}
			});
		}
开发者ID:jairov4,项目名称:Yorkfield,代码行数:40,代码来源:LogServer.cs

示例8: Log

 /// <summary>
 /// Log a message.
 /// </summary>
 /// <param name="severity">Severity.</param>
 /// <param name="message">Message.</param>
 /// <param name="args">Format arguments.</param>
 public static void Log(LogSeverity severity, string message, params string[] args)
 {
     if (OnLog != null)
     {
         OnLog(severity, string.Format(message, args));
     }
 }
开发者ID:LETO-R,项目名称:TorDNSd,代码行数:13,代码来源:Logger.cs

示例9: Log

        public void Log(LogSeverity severity, string message, params object[] args)
        {
            if (!Environment.UserInteractive) return;
            if ((int)severity < (int)this.minimalSeverity) return;

            var color = Console.ForegroundColor;

            switch (severity)
            {
                case LogSeverity.Debug:
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("{0}\t{1}\t{2}", severity, DateTime.Now, string.Format(message, args));
                    Console.ForegroundColor = color;
                    break;
                case LogSeverity.Info:
                case LogSeverity.Warn:
                    Console.WriteLine("{0}\t{1}\t{2}", severity, DateTime.Now, string.Format(message, args));
                    break;
                case LogSeverity.Error:
                case LogSeverity.Critical:
                default:
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Error.WriteLine("{0}\t{1}\t{2}", severity, DateTime.Now, string.Format(message, args));
                    Console.ForegroundColor = color;
                    break;
            }
        }
开发者ID:hash,项目名称:trigger.net,代码行数:27,代码来源:ConsoleLogger.cs

示例10: LogMessageEventArgs

 public LogMessageEventArgs(LogSeverity severity, string source, string msg, Exception exception)
 {
     Severity = severity;
     Source = source;
     Message = msg;
     Exception = exception;
 }
开发者ID:Carbonitex,项目名称:Discord.Net,代码行数:7,代码来源:LogMessageEventArgs.cs

示例11: LogItem

		/// <summary>
		/// Initializes a new instance of the <see cref="LogItem"/> struct.
		/// </summary>
		/// <param name="timestamp">The timestamp.</param>
		/// <param name="severity">The severity.</param>
		/// <param name="message">The message.</param>
		public LogItem(DateTimeOffset? timestamp, LogSeverity severity, string message)
		{
			RequiresNotNull(message);
			this.timestamp = timestamp;
			this.severity = severity;
			this.message = message;
		}
开发者ID:jairov4,项目名称:Yorkfield,代码行数:13,代码来源:LogItem.cs

示例12: LogEventArgs

 /// <summary>
 /// Constructor of LogEventArgs.
 /// </summary>
 /// <param name="severity">Log severity.</param>
 /// <param name="message">Log message</param>
 /// <param name="exception">Inner exception.</param>
 /// <param name="date">Log date.</param>
 public LogEventArgs(LogSeverity severity, string message, Exception exception, DateTime date)
 {
     Severity = severity;
     Message = message;
     Exception = exception;
     Date = date;
 }
开发者ID:tuansolo,项目名称:CodeBase,代码行数:14,代码来源:LogEventArgs.cs

示例13: Log

        /// <inheritdoc />
        public void Log(LogSeverity severity, string message, ExceptionData exceptionData)
        {
            if (message == null)
                throw new ArgumentNullException("message");

            LogImpl(severity, message, exceptionData);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:8,代码来源:BaseLogger.cs

示例14: LogImpl

        /// <inheritdoc />
        protected override void LogImpl(LogSeverity severity, string message, ExceptionData exceptionData)
        {
            switch (severity)
            {
                case LogSeverity.Error:
                    testListener.WriteLine(message, FacadeCategory.Error);
                    break;

                case LogSeverity.Warning:
                    testListener.WriteLine(message, FacadeCategory.Warning);
                    break;

                case LogSeverity.Important:
                case LogSeverity.Info:
                    testListener.WriteLine(message, FacadeCategory.Info);
                    break;

                case LogSeverity.Debug:
                    testListener.WriteLine(message, FacadeCategory.Debug);
                    break;
            }

            if (exceptionData != null)
                testListener.WriteLine(exceptionData.ToString(), FacadeCategory.Error);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:26,代码来源:TDNetLogger.cs

示例15: Log

 public void Log(string message, LogSeverity logSeverity)
 {
     Console.ForegroundColor = DetermineColor(logSeverity);
     Console.Write(message);
     Console.WriteLine();
     Console.ResetColor();
 }
开发者ID:fernandozamoraj,项目名称:DirectoryWiz,代码行数:7,代码来源:Program.cs


注:本文中的LogSeverity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。