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


C# ILogFormatter.Format方法代码示例

本文整理汇总了C#中ILogFormatter.Format方法的典型用法代码示例。如果您正苦于以下问题:C# ILogFormatter.Format方法的具体用法?C# ILogFormatter.Format怎么用?C# ILogFormatter.Format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILogFormatter的用法示例。


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

示例1: ToString

        public string ToString(ILogFormatter formatter)
        {
            if (formatter == null) return ToString();

            try
            {
                return formatter.Format(this);
            }
            catch
            {
                return ToString();
            }
        }
开发者ID:subfuzion,项目名称:dotlog,代码行数:13,代码来源:LogEntry.cs

示例2: Append

		/// <summary>
		/// Escreve o resultado de um <see cref="LogEntry"/> no <see cref="System.Console"/>.
		/// </summary>
		/// <param name="logger">O logger</param>
		/// <param name="formatter">O formatador</param>
		/// <param name="entry">A entrada no log</param>
		public void Append(ILogger logger, ILogFormatter formatter, LogEntry entry)
		{
			Console.WriteLine(formatter.Format(entry));
		}
开发者ID:elementar,项目名称:Suprifattus.Util,代码行数:10,代码来源:ConsoleAppender.cs

示例3: Log

        public void Log(LogEntry entry, ILogFormatter formatter)
        {
            if (!_Enabled) return;
            SplitLog();

            try
            {
                string logLine = formatter.Format(entry) + "\r\n";
                File.AppendAllText(_Location, logLine);
            }
            catch { return; }
        }
开发者ID:michaelAngeloEgypt,项目名称:XLogger,代码行数:12,代码来源:XLogger.cs

示例4: Log

 public void Log(string message, LogLevel logLevel, ILogFormatter logFormatter)
 {
     this.LastMessage = logFormatter.Format(message, logLevel, LogTime);
     this.LastLogLevel = logLevel;
     this.LastLogFormatter = logFormatter;
 }
开发者ID:moszinet,项目名称:HomeAutomation,代码行数:6,代码来源:LogTests.cs

示例5: AssertSerializingLogFormatter

 internal static void AssertSerializingLogFormatter(ILogFormatter logFormatter, Mock<ISerializer> mockSerializer)
 {
     Assert.That(logFormatter.Format(null), Is.EqualTo("Hello, world!"));
     mockSerializer.Verify(m => m.SerializeToString(It.IsAny<object>(), It.IsAny<Type>()), Times.Once());
 }
开发者ID:Orthak,项目名称:Rock.Logging,代码行数:5,代码来源:SerializingLogFormatterTests.cs

示例6: FormatEntry

        /// <summary>
        /// Formats the given <see cref="LogEntry"></see> through the given <see cref="ILogFormatter"></see>
        /// </summary>
        /// <param name="formatter">Instance of class implementing the <see cref="ILogFormatter"></see> interface</param>
        /// <param name="logEntry">The <see cref="LogEntry"></see> to format</param>
        /// <returns>The formatted <see cref="LogEntry"></see></returns>
        protected virtual string FormatEntry(ILogFormatter formatter, LogEntry logEntry)
        {
            string formattedMessage = formatter.Format(logEntry);

            if (logEntry.ErrorMessages != null)
            {
                formattedMessage = logEntry.ErrorMessages.ToString() + "Message: " +
                    Environment.NewLine + formattedMessage;
            }

            return formattedMessage;
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:18,代码来源:DefaultLogDestination.cs

示例7: Log

 public void Log(string message, LogLevel logLevel, ILogFormatter logFormatter)
 {
     Debug.WriteLine(logFormatter.Format(message, logLevel, DateTime.Now));
 }
开发者ID:moszinet,项目名称:HomeAutomation,代码行数:4,代码来源:ConsoleLogWriter.cs


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