本文整理汇总了C#中LogType.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# LogType.Equals方法的具体用法?C# LogType.Equals怎么用?C# LogType.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogType
的用法示例。
在下文中一共展示了LogType.Equals方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetLogger
static void SetLogger(LogType type, string text, params object[] args)
{
switch (type)
{
case LogType.Normal:
Console.ForegroundColor = ConsoleColor.Green;
text = text.Insert(0, "System: ");
break;
case LogType.Error:
Console.ForegroundColor = ConsoleColor.Red;
text = text.Insert(0, "Error: ");
break;
case LogType.Dump:
Console.ForegroundColor = ConsoleColor.Yellow;
break;
case LogType.Init:
Console.ForegroundColor = ConsoleColor.Cyan;
break;
case LogType.Cmd:
Console.ForegroundColor = ConsoleColor.Green;
break;
case LogType.Debug:
Console.ForegroundColor = ConsoleColor.DarkRed;
break;
default:
break;
}
if (type.Equals(LogType.Init) | type.Equals(LogType.Default))
Console.WriteLine(text, args);
else if (type.Equals(LogType.Dump) || type.Equals(LogType.Cmd))
Console.Write(text, args);
else
Console.WriteLine("[" + DateTime.Now.ToLongTimeString() + "] " + text, args);
}
示例2: handleLog
/// <summary>
/// Handles captured messages from the debug console
/// </summary>
/// <param name="logString">The message displayed</param>
/// <param name="stackTrace">Stack trace of where the message occured (Mainly used with error and exception messaged)</param>
/// <param name="type">What kind of message (Log, Warning, Warning, Error, Exception, Assert)</param>
private void handleLog(string logString, string stackTrace, LogType type)
{
//If it's a log, just output it
if (type.Equals(LogType.Log))
{
println(logString);
}//If it's a warning, include that type (Warning)
else if(type.Equals(LogType.Warning))
{
println(type + ": " + logString);
}//Otherwise, it is serious and output the type, log, and stacktrace
else
{
//Wrapping lines messes up the console
//This curbs it a bit, but still allows for some stack output
//Since in an error, reading what's wrong is most important
if (stackTrace.Length < 250)
{
println(type + ": " + logString + " " + stackTrace);
}
else
{
println(type + ": " + logString + " " + stackTrace.Substring(0, 250));
}
}
}
示例3: Log
public static void Log(string logText, LogType type = LogType.Info)
{
if (type.Equals(LogType.Info))
{
Trace.TraceInformation(DateTime.Now.ToString(DateFormat) + ": " + logText);
}
else if (type.Equals(LogType.Error))
{
Trace.TraceError(DateTime.Now.ToString(DateFormat) + ": " + logText);
}
else if (type.Equals(LogType.Warning))
{
Trace.TraceWarning(DateTime.Now.ToString(DateFormat) + ": " + logText);
}
}
示例4: SetLogger
static void SetLogger(LogType type, string text, params object[] args)
{
switch (type)
{
case LogType.NORMAL:
DefaultConsole.ForegroundColor = ConsoleColor.Green;
text = text.Insert(0, "System: ");
break;
case LogType.ERROR:
DefaultConsole.ForegroundColor = ConsoleColor.Red;
text = text.Insert(0, "Error: ");
break;
case LogType.DUMP:
DefaultConsole.ForegroundColor = ConsoleColor.Yellow;
break;
case LogType.INIT:
DefaultConsole.ForegroundColor = ConsoleColor.Cyan;
break;
case LogType.MISC:
DefaultConsole.ForegroundColor = ConsoleColor.DarkBlue;
break;
case LogType.CMD:
DefaultConsole.ForegroundColor = ConsoleColor.Green;
break;
case LogType.DEBUG:
DefaultConsole.ForegroundColor = ConsoleColor.DarkRed;
break;
default:
DefaultConsole.ForegroundColor = ConsoleColor.White;
break;
}
if (type.Equals(LogType.INIT) | type.Equals(LogType.DEFAULT))
DefaultConsole.WriteLine(text, args);
else if (type.Equals(LogType.DUMP) || type.Equals(LogType.CMD))
DefaultConsole.WriteLine(text, args);
else
{
DefaultConsole.WriteLine("[" + DateTime.Now.ToLongTimeString() + "] " + text, args);
}
}
示例5: HandleLog
//Capture debug.log output, send logs to Loggly
public void HandleLog(string logString, string stackTrace, LogType type)
{
if ((type.Equals (LogType.Log) || type.Equals(LogType.Warning)) && !ENABLE_DEBUG_LOGS) {
return;
}
//Initialize WWWForm and store log level as a string
level = type.ToString ();
var loggingForm = new WWWForm();
//Add log message to WWWForm
loggingForm.AddField("LEVEL", level);
loggingForm.AddField("Message", logString);
loggingForm.AddField("Stack_Trace", stackTrace);
//Add any User, Game, or Device MetaData that would be useful to finding issues later
loggingForm.AddField("Device_Model", SystemInfo.deviceModel);
//Send WWW Form to Loggly, replace TOKEN with your unique ID from Loggly
var sendLog = new WWW("http://logs-01.loggly.com/inputs/" + LogglyCredential.TOKEN + "/tag/Unity3D/", loggingForm);
}
示例6: SetLogger
static void SetLogger(LogType type, string text, params object[] args)
{
DefaultConsole.OutputEncoding = UTF8Encoding.UTF8;
switch (type)
{
case LogType.NORMAL:
DefaultConsole.ForegroundColor = ConsoleColor.Green;
text = text.Insert(0, "System: ");
break;
case LogType.ERROR:
DefaultConsole.ForegroundColor = ConsoleColor.Red;
text = text.Insert(0, "Error: ");
break;
case LogType.DUMP:
DefaultConsole.ForegroundColor = ConsoleColor.Yellow;
break;
case LogType.INIT:
DefaultConsole.ForegroundColor = ConsoleColor.Cyan;
break;
case LogType.DB:
DefaultConsole.ForegroundColor = ConsoleColor.DarkMagenta;
break;
case LogType.CMD:
DefaultConsole.ForegroundColor = ConsoleColor.Green;
break;
case LogType.DEBUG:
DefaultConsole.ForegroundColor = ConsoleColor.DarkRed;
break;
default:
DefaultConsole.ForegroundColor = ConsoleColor.White;
break;
}
if (((Log.ServerType == "World" ? WorldConfig.LogLevel : RealmConfig.LogLevel) & type) == type)
{
if (type.Equals(LogType.INIT) | type.Equals(LogType.DEFAULT))
DefaultConsole.WriteLine(text, args);
else if (type.Equals(LogType.DUMP) || type.Equals(LogType.CMD))
DefaultConsole.WriteLine(text, args);
else
DefaultConsole.WriteLine("[" + DateTime.Now.ToLongTimeString() + "] " + text, args);
}
}
示例7: SetLogger
static void SetLogger(LogType type, string text, params object[] args)
{
if ((logLevel & type) == type)
{
ConsoleColor foreGround;
switch (type)
{
case LogType.Init:
foreGround = ConsoleColor.Cyan;
break;
case LogType.Normal:
foreGround = ConsoleColor.Green;
text = text.Insert(0, "System: ");
break;
case LogType.Error:
foreGround = ConsoleColor.Red;
text = text.Insert(0, "Error: ");
break;
case LogType.Debug:
foreGround = ConsoleColor.DarkRed;
text = text.Insert(0, "Debug: ");
break;
case LogType.Packet:
foreGround = ConsoleColor.Yellow;
break;
case LogType.Database:
foreGround = ConsoleColor.DarkMagenta;
break;
case LogType.Network:
foreGround = ConsoleColor.Magenta;
break;
default:
foreGround = ConsoleColor.White;
break;
}
if (type.Equals(LogType.Init) || type.Equals(LogType.None))
logQueue.Add(Tuple.Create(foreGround, string.Format(text, args)));
else
logQueue.Add(Tuple.Create(foreGround, string.Format("[" + DateTime.Now.ToLongTimeString() + "] " + text, args)));
}
}
示例8: SetLogger
static void SetLogger(LogType type, string text, params object[] args)
{
var solidColor = new XMedia.SolidColorBrush();
switch (type)
{
case LogType.NORMAL:
solidColor.Color = Colors.Green;
CurrentBlock.Foreground = solidColor;
text = text.Insert(0, "System: ");
break;
case LogType.ERROR:
solidColor.Color = Colors.Green;
CurrentBlock.Foreground = solidColor;
text = text.Insert(0, "Error: ");
break;
case LogType.DUMP:
solidColor.Color = Colors.Green;
CurrentBlock.Foreground = solidColor;
break;
case LogType.INIT:
solidColor.Color = Colors.Green;
CurrentBlock.Foreground = solidColor;
break;
case LogType.MISC:
solidColor.Color = Colors.Green;
CurrentBlock.Foreground = solidColor;
break;
case LogType.CMD:
solidColor.Color = Colors.Green;
CurrentBlock.Foreground = solidColor;
break;
case LogType.DEBUG:
solidColor.Color = Colors.Green;
CurrentBlock.Foreground = solidColor;
break;
default:
solidColor.Color = Colors.Green;
CurrentBlock.Foreground = solidColor;
break;
}
StringBuilder logText = new StringBuilder();
if (type.Equals(LogType.INIT) | type.Equals(LogType.DEFAULT))
logText.AppendFormat(text, args);
else if (type.Equals(LogType.DUMP) || type.Equals(LogType.CMD))
logText.AppendFormat(text, args);
else
logText.AppendFormat("[" + DateTime.Now.ToString() + "] " + text, args);
CurrentBlock.Text += logText.ToString() + "\n";
}