本文整理汇总了C#中LogMessageType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# LogMessageType.ToString方法的具体用法?C# LogMessageType.ToString怎么用?C# LogMessageType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogMessageType
的用法示例。
在下文中一共展示了LogMessageType.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendLog
// Help methods that use our FileSystem abstraction
public override void AppendLog(String message, LogMessageType messageType)
{
string textEntry = string.Format("{0:MM-dd-yyyy HH:mm:ss:ffff} :{1}: [{2}] {3}", DateTime.Now, System.Threading.Thread.CurrentThread.ManagedThreadId, messageType.ToString(), message);
switch (messageType)
{
case LogMessageType.Info:
Android.Util.Log.Info(TAG, message);
break;
case LogMessageType.Warn:
Android.Util.Log.Debug(TAG, message);
break;
case LogMessageType.Debug:
Android.Util.Log.Debug(TAG, message);
break;
case LogMessageType.Error:
Android.Util.Log.Error(TAG, message);
break;
case LogMessageType.Fatal:
Android.Util.Log.Wtf(TAG, message);
break;
case LogMessageType.Metric:
Android.Util.Log.Debug( TAG_METRIC, message );
break;
default:
break;
}
AppendText(LogFileName, textEntry);
}
示例2: AppendLog
// Help methods that use our FileSystem abstraction
public override void AppendLog(String message, LogMessageType messageType)
{
string textEntry = string.Format("{0:MM-dd-yyyy HH:mm:ss:ffff} :{1}: [{2}] {3}", DateTime.Now, System.Threading.Thread.CurrentThread.ManagedThreadId, messageType.ToString(), message);
Console.WriteLine(textEntry);
AppendText(LogFileName, textEntry);
}
示例3: AppendLog
public override void AppendLog(String message, LogMessageType messageType)
{
string textEntry = string.Format("{0:MM-dd-yyyy HH:mm:ss:ffff} :{1}: [{2}] {3}", DateTime.Now, System.Threading.Thread.CurrentThread.ManagedThreadId, messageType.ToString(), message);
//First write to console
Console.WriteLine(textEntry);
bool passCheckPoint = false;
if (CheckPointError && LogMessageType.Error == messageType) { passCheckPoint = true; }
else if (CheckPointWarn && LogMessageType.Warn == messageType) { passCheckPoint = true; }
else if (CheckPointInfo && LogMessageType.Info == messageType) { passCheckPoint = true; }
else if (CheckPointDebug && LogMessageType.Debug == messageType) { passCheckPoint = true; }
else if (CheckPointMetric && LogMessageType.Metric == messageType) { passCheckPoint = true; }
// Log a Checkpoint if necessary
if (passCheckPoint) { TestFlight.PassCheckpoint(message); }
AppendText(textEntry);
}
示例4: BuildExceptionMessage
internal static string BuildExceptionMessage(Exception ex, LogMessageType logMessageType )
{
string exMessage =
string.Format("Date: {0}, [Exception]\n {1}\n Message: {2}\n Stack: {3}",
DateTime.Now.ToString(),
logMessageType.ToString(),
ex.Message,
ex.StackTrace);
// Include the Data collection
exMessage += "\n Data:";
foreach (var item in ex.Data.Keys)
exMessage += string.Format(" key:{0}, value:{1};", item, ex.Data[item]);
// Are there any inner exceptions?
while (ex.InnerException != null)
{
exMessage += BuildInnerExceptionMessage(ex.InnerException);
ex = ex.InnerException;
}
return exMessage;
}
示例5: WriteMessage
/// <summary>
/// The function called when a message is logged
/// </summary>
/// <param name="message">The message logged</param>
/// <param name="type">The type of message logged</param>
/// <param name="exception">An exception, may be null</param>
public virtual void WriteMessage(string message, LogMessageType type, Exception exception)
{
m_stream.WriteLine(type.ToString() + ": " + message);
if (exception != null)
{
m_stream.WriteLine(exception.ToString());
m_stream.WriteLine();
}
if (EventLogged != null)
EventLogged(message, type, exception);
}
示例6: AppendLog
// Help methods that use our FileSystem abstraction
public void AppendLog( String message, LogMessageType messageType )
{
string textEntry = string.Format( "{0:MM-dd-yyyy HH:mm:ss:ffff} :{1}: [{2}] {3}", DateTime.Now, System.Threading.Thread.CurrentThread.ManagedThreadId, messageType.ToString(), message );
Console.WriteLine( textEntry );
string fileName = LogPath + LogHelper.GetFileNameYYYMMDD( _fileType, _fileExt );
FileHelper.AppendText( fileName, textEntry );
}
示例7: Log
public override void Log(LogMessageType type, bool logToConsole, string message)
{
if (logToConsole || _alwaysPrintToConsole)
Debug.Log(string.Format("[{0}]: {1}", type.ToString(), message));
}
示例8: LogMessage
public void LogMessage(string message, LogMessageType type = LogMessageType.Info)
{
Console.WriteLine("[{0}] {1}", type.ToString().ToUpper(), message);
}
示例9: Write
/// <summary>
/// Write message ty exception and message type
/// </summary>
/// <param name="e">exception</param>
/// <param name="messageType">message type</param>
/// <param name="classType">classType </param>
/// <param name="methodName"> method Name</param>
public void Write(Exception e, LogMessageType messageType, Type classType, string methodName)
{
Write(new LogMessage(e.Message + e.StackTrace, messageType.ToString(), classType, methodName));
}
示例10: Log
public bool Log(string userID, string userName, string messageString, LogMessageType messageType)
{
string msgType = messageType.ToString();
string body = "User ID: " + userID + "\n";
body += "User Name: " + userName + "\n";
body += "Message Type: " + msgType + "\n";
body += "Message: " + messageString + "\n";
emailSender.SendMail("[email protected]",
"Log (" + msgType + ") North Carolina Tax Recovery Calculator",
body);
return true;
}