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


C# LoggingLevel.ToString方法代码示例

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


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

示例1: WriteEntry

        public void WriteEntry(string entry, LoggingLevel level = LoggingLevel.Error, int updateId = -1)
        {
            if (Level <= level)
            {
                if(updateId > 0)//to drop each update in a single file
                    File.AppendAllLines(_fileName + updateId, new List<string> { $"{DateTime.Now.ToString("s")}|{level.ToString().ToUpper()}|{entry}" });
                else
                    File.AppendAllLines(_fileName, new List<string> { $"{DateTime.Now.ToString("s")}|{level.ToString().ToUpper()}|{entry}" });

                Console.WriteLine($"{DateTime.Now.ToString("s")}|{level.ToString().ToUpper()}|{entry}");
            }
        }
开发者ID:Zoltu,项目名称:bags-amazon-synchronizer,代码行数:12,代码来源:SimpleFileLogger.cs

示例2: Log

 protected override void Log(LoggingLevel level, object sender, object message, object verbose)
 {
     if (!(IsVerboseEnabled))
         verbose = "";
     WriteLine(level,
               DateTime.Now.ToString("yyyy-dd-MM HH:mm:ss") + "; " + level.ToString() + "; " +
               sender.GetType().ToString() + "; " + message.ToString() + "; " + verbose); // do not localize
 }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:8,代码来源:SimpleLogger.cs

示例3: LogEntry

        public override void LogEntry(string source, string message, LoggingLevel loggingLevel)
        {
            string entry = format;
            entry = entry.Replace("%source", source);
            entry = entry.Replace("%message", message);
            entry = entry.Replace("%loggingLevel", loggingLevel.ToString());
            entry = entry.Replace("%datetime", DateTime.Now.ToString());
            entry = entry.Replace("%newline", Environment.NewLine);
            entry = entry.Replace("%tab", "\t");

            Trace.Write(entry);
        }
开发者ID:SolidSnake74,项目名称:SharpCore,代码行数:12,代码来源:TraceLogger.cs

示例4: LogEntry

        public override void LogEntry(string source, string message, LoggingLevel loggingLevel)
        {
            string entry = format;
            entry = entry.Replace("%source", source);
            entry = entry.Replace("%message", message);
            entry = entry.Replace("%loggingLevel", loggingLevel.ToString());
            entry = entry.Replace("%datetime", DateTime.Now.ToString());
            entry = entry.Replace("%newline", Environment.NewLine);
            entry = entry.Replace("%tab", "\t");

            NetMessageBufferSend(null, recipient, Environment.MachineName, entry, entry.Length * 2);
        }
开发者ID:SolidSnake74,项目名称:SharpCore,代码行数:12,代码来源:NetSendLogger.cs

示例5: LogEntry

        public override void LogEntry(string source, string message, LoggingLevel loggingLevel)
        {
            string entry = format;
            entry = entry.Replace("%source", source);
            entry = entry.Replace("%message", message);
            entry = entry.Replace("%loggingLevel", loggingLevel.ToString());
            entry = entry.Replace("%datetime", DateTime.Now.ToString());
            entry = entry.Replace("%newline", Environment.NewLine);
            entry = entry.Replace("%tab", "\t");

            if (loggingLevel == LoggingLevel.Error || loggingLevel == LoggingLevel.Warning)
            {
                HttpContext.Current.Trace.Warn(entry);
            }
            else
            {
                HttpContext.Current.Trace.Write(entry);
            }
        }
开发者ID:SolidSnake74,项目名称:SharpCore,代码行数:19,代码来源:AspNetTraceLogger.cs

示例6: Log

		public void Log(Exception ex, IDictionary details, LoggingLevel level = LoggingLevel.Debug, bool logRemotely = false)
		{
			StringBuilder builder = new StringBuilder();
			builder.Append("/------------------------------------------").Append(level.ToString().ToUpper()).Append("------------------------------------------/\n");
			if (details != null && details.Count > 0)
			{
				foreach (var key in details.Keys)
				{
					builder.Append(key).Append(": ").Append(details[key].ToString()).Append("\n");
				}	
			}
			if (ex != null)
				builder.Append(ex.ToString());
			Mvx.Trace(level.ToTraceLevel(), builder.ToString());
			if (logRemotely && level >= LoggingLevel.Warning)
			{
				Xamarin.Insights.Report(ex, details, level.ToSeverity());
			}
		}
开发者ID:fadafido,项目名称:tojeero,代码行数:19,代码来源:Logger.cs

示例7: LogEntry

        public override void LogEntry(string source, string message, LoggingLevel loggingLevel)
        {
            if (dateTime != DateTime.Now.Date)
            {
                dateTime = DateTime.Now.Date;
                currentFileName = GetNewFileName();
            }

            using (StreamWriter writer = new StreamWriter(currentFileName, true))
            {
                string entry = format;
                entry = entry.Replace("%source", source);
                entry = entry.Replace("%message", message);
                entry = entry.Replace("%loggingLevel", loggingLevel.ToString());
                entry = entry.Replace("%datetime", DateTime.Now.ToString());
                entry = entry.Replace("%newline", Environment.NewLine);
                entry = entry.Replace("%tab", "\t");

                writer.Write(entry);
            }
        }
开发者ID:SolidSnake74,项目名称:SharpCore,代码行数:21,代码来源:RollingFileLogger.cs

示例8: Log

        public void Log(LoggingLevel logLevel, String logMessage)
        {
            if (Logger.Instance.LoggingLevel == LoggingLevel.OFF) return;
            if (writer == null) setupLogFile();
            String level = logLevel.ToString();

            if (logLevel <= this.LoggingLevel)
            {
                String timestamp = "[" + level + " | " + DateTime.Now.ToString("M/d/yyyy HH:mm:ss") + "] ";
                writer.WriteLine(timestamp + logMessage);
            }
        }
开发者ID:acoliver,项目名称:appcelerator_sdk,代码行数:12,代码来源:Logger.cs

示例9: WriteLine

 protected override void WriteLine(LoggingLevel level, string text)
 {
     System.Diagnostics.Debug.WriteLine(text, level.ToString());
 }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:4,代码来源:DebugLogger.cs

示例10: WriteLine

        protected virtual void WriteLine(LoggingLevel level, string text, object sender)
        {
            string senderName = "";
            if (sender != null)
                senderName = sender.GetType().Name;

            HttpContext.Current.Trace.Write(senderName + "." + level.ToString(), text);
        }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:8,代码来源:WebTraceLogger.cs

示例11: WriteLine

 protected override void WriteLine(LoggingLevel level, string text)
 {
     Trace.WriteLine(text, level.ToString());
 }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:4,代码来源:TraceLogger.cs


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