本文整理汇总了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}");
}
}
示例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
}
示例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);
}
示例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);
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例9: WriteLine
protected override void WriteLine(LoggingLevel level, string text)
{
System.Diagnostics.Debug.WriteLine(text, level.ToString());
}
示例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);
}
示例11: WriteLine
protected override void WriteLine(LoggingLevel level, string text)
{
Trace.WriteLine(text, level.ToString());
}