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


C# LogMessageType.ToString方法代码示例

本文整理汇总了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);
        }
开发者ID:BGCX262,项目名称:zulu-omoto-pos-client-svn-to-git,代码行数:31,代码来源:AndroidLogger.cs

示例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);
        }
开发者ID:BGCX262,项目名称:zulu-omoto-pos-client-svn-to-git,代码行数:9,代码来源:BasicLogger.cs

示例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);
        }
开发者ID:benhorgen,项目名称:MonoCross_TestFlightLogger,代码行数:19,代码来源:TestFlightLogger.cs

示例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;
        }
开发者ID:oduma,项目名称:Sciendo.Fitas.Droid,代码行数:23,代码来源:LogHelper.cs

示例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);
        }
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:18,代码来源:StreamLog.cs

示例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 );
        }
开发者ID:oduma,项目名称:Sciendo.Fitas.Droid,代码行数:9,代码来源:TargetLogger.cs

示例7: Log

 public override void Log(LogMessageType type, bool logToConsole, string message)
 {
     if (logToConsole || _alwaysPrintToConsole)
         Debug.Log(string.Format("[{0}]: {1}", type.ToString(), message));
 }
开发者ID:acid1789,项目名称:FantasyFliers,代码行数:5,代码来源:NetLogger.cs

示例8: LogMessage

 public void LogMessage(string message, LogMessageType type = LogMessageType.Info)
 {
     Console.WriteLine("[{0}] {1}", type.ToString().ToUpper(), message);
 }
开发者ID:hexafluoride,项目名称:byteflood,代码行数:4,代码来源:Listener.cs

示例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));
 }
开发者ID:snbbgyth,项目名称:gatewayWeb,代码行数:11,代码来源:LogHelper.cs

示例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;
        }
开发者ID:kevinhicks,项目名称:NorthCarolinaTaxRecoveryCalculator,代码行数:14,代码来源:Logger.cs


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