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


C# LogType类代码示例

本文整理汇总了C#中LogType的典型用法代码示例。如果您正苦于以下问题:C# LogType类的具体用法?C# LogType怎么用?C# LogType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: LogCallback

    private static void LogCallback(string message, string trace, LogType type)
    {
        if (System.Array.IndexOf(logTypes, type) != -1) {
            string supportData = null;
            try {
                if (collectSupportData != null) {
                    supportData = collectSupportData();
                }
            }
            catch {
            }
            try {
                var form = new WWWForm();
                form.AddField("application", SafeString(appName));
                form.AddField("version", SafeString(version));
                form.AddField("userData", SafeString(userData));
                form.AddField("supportData", SafeString(supportData));
                form.AddField("userId", SafeString(userId));
                form.AddField("message", SafeString(message));
                form.AddField("trace", SafeString(trace));

                new WWW(uri, form.data);
            }
            catch {
            }
        }
    }
开发者ID:duke1102,项目名称:unity-plus,代码行数:27,代码来源:ErrorReporter.cs

示例2: Log

        public void Log(string message, LogType logType, string userUsername)
        {
            GlobalContext.Properties["LogType"] = logType.ToString();
            GlobalContext.Properties["UserUsername"] = userUsername;

            log.Info(message);
        }
开发者ID:pabloperfalc,项目名称:TallerDiseno,代码行数:7,代码来源:Logger.cs

示例3: LogFormat

 public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args)
 {
     Debug.logger.logHandler.LogFormat(logType, context, format, args);
     if (UILogView.sInstance != null) {
         UILogView.sInstance.AddLog (string.Format (format, args));
     }
 }
开发者ID:2ty,项目名称:race3d,代码行数:7,代码来源:UILogHandler.cs

示例4: WriteLine

        public static void WriteLine( LogType logType, string line )
        {
            try
            {
                LogType textLogVerboseFlag = sVerboseEnabled ? LogType.TextLogVerbose : (LogType)0;
                DateTime now = DateTime.Now;
                string dateLine = string.Format( "[{0} {1:d2}{2:d2}{3:d2}] {4}", now.ToShortDateString(), now.Hour, now.Minute, now.Second, line );

                if ( ( logType & ( LogType.AppLog | LogType.Error ) ) > 0 )
                    GUI.MainForm.Instance.LogBox.WriteLine( now, line, ( ( logType & LogType.Error ) > 0 ) ? System.Drawing.Color.Red : System.Drawing.Color.Black );

                if ( (logType & ( LogType.DebugLog | LogType.Error | textLogVerboseFlag ) ) > 0 )
                    System.Diagnostics.Debug.WriteLine( dateLine );

                if ( (logType & ( LogType.TextLog | LogType.Error | textLogVerboseFlag ) ) > 0 )
                {
                    ReloadLogFile();

                    if ( mFileLog != null )
                    {
                        mFileLog.WriteLine( dateLine );
                        mFileLog.Flush();
                    }
                }

                if ( LogLineEvent != null )
                    LogLineEvent( line );
            }
            catch ( System.Exception )
            {
            }
        }
开发者ID:peteward44,项目名称:auto-usb-backup,代码行数:32,代码来源:Log.cs

示例5: log

 public void log(string msg, int lvl, LoggingException e, LogType l, params Object[] p)
 {
     if (lvl <= this._maxLvl)
     {
         Logging.logStream(Console.Out, msg, lvl, e, l, p);
     }
 }
开发者ID:pouc,项目名称:qv-extension-server,代码行数:7,代码来源:Logging.cs

示例6: Log

 void Log (LogType type,  string message)
 {
     using (var streamWriter = new StreamWriter(dir + _name, true))
     {
         streamWriter.WriteLine(DateTime.Now.ToLongTimeString() + " | " + type.ToString().ToUpper() + " | " + message);
     }
 }
开发者ID:SteinLabs,项目名称:Mosh_CSharp_Intermediate,代码行数:7,代码来源:FileLogger.cs

示例7: 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));
         }
     }
 }
开发者ID:Awkbak,项目名称:Procrastination,代码行数:32,代码来源:DebugScript.cs

示例8: HandleUnityLog

        /// <summary>
        /// Handles the standard unity log output.
        /// </summary>
        /// <param name='logString'>
        /// Log string.
        /// </param>
        /// <param name='stackTrace'>
        /// Stack trace.
        /// </param>
        /// <param name='type'>
        /// Type.
        /// </param>
        public void HandleUnityLog(string logString, string stackTrace, LogType type)
        {
            if (stackTrace == null)
                stackTrace = "(null)";

            if (logString == null)
                logString = "(null)";

                switch(type)
                {
                    case LogType.Log:
                        _log(logString, "Unity3D.Debug.Log", "DEBUG");
                        break;
                    case LogType.Warning:
                        _log(logString, "Unity3D.Debug.LogWarning", "WARN");
                        break;
                    case LogType.Error:
                        _log(logString, "Unity3D.Debug.LogError", "ERROR");
                        break;
                    case LogType.Exception:

                        _log(logString + ": " + stackTrace, "Unity3D.Debug.LogException", "FATAL");
                        break;
                    case LogType.Assert:
                        _log(logString, "Unity3D.Debug.LogAssert", "INFO");
                        break;
                    default:
                        _log(logString, "Unity3D.Debug.Log", "INFO");
                        break;
                }
        }
开发者ID:derFunk,项目名称:unity3d-webplayer-jslogger,代码行数:43,代码来源:JavascriptLogger.cs

示例9: HandleLog

 private static void HandleLog(string condition, string stackTrace, LogType type)
 {
     for (var i = 0; i < _callbacks.Count; ++i)
     {
     _callbacks[i](condition, stackTrace, type);
     }
 }
开发者ID:wooga,项目名称:ps_social_jam,代码行数:7,代码来源:LogCallbackHandler.cs

示例10: GetMessage

        private static string GetMessage(LogType type, string message, Exception exception = null)
        {
            string messageToLog = string.Empty;
            if (exception != null)
            {
                messageToLog = string.Format(LogMessageException,
                    GetTimeStamp(),
                    type.ToString(),
                    message,
                    exception.GetType(),
                    exception.Message,
                    (exception.InnerException != null && exception.InnerException.Message != null) ? exception.InnerException.Message : "None",
                    exception.Source
                    );
            }
            else
            {
                messageToLog = string.Format(LogMessageBrief,
                    GetTimeStamp(),
                    type.ToString(),
                    message
                    );
            }

            return messageToLog;
        }
开发者ID:wpdu,项目名称:ControlTest,代码行数:26,代码来源:ConsoleLogger.cs

示例11: Write

        public void Write(string Message, LogType MessageType)
        {
            string sAssembly = Assembly.GetCallingAssembly().FullName;
            string sMethod = qualifiedObjName();

            this.Write(sAssembly, sMethod, Message, MessageType);
        }
开发者ID:gbarnes12,项目名称:atlantis-xna,代码行数:7,代码来源:Logger.cs

示例12: LogAsync

        public Task<bool> LogAsync(LogType type, string message)
        {
            var messageToLog = GetMessage(type, message);
            System.Diagnostics.Debug.WriteLine(messageToLog);

            return Task.FromResult(true);
        }
开发者ID:wpdu,项目名称:ControlTest,代码行数:7,代码来源:ConsoleLogger.cs

示例13: Log

 // Log Handler
 public static void Log(LogType lt, string format, params object[] parameters)
 {
     if (bot.InvokeRequired)
         bot.Invoke(new LogInvoke(Log), new object[] { lt, format, parameters });
     else
         bot.Log(lt, String.Format(format, parameters));
 }
开发者ID:icaca,项目名称:boogiebot,代码行数:8,代码来源:Program.cs

示例14: LogTrace

 public static void LogTrace(LogType logType, string message, params object[] args)
 {
     try
     {
         switch (logType)
         {
             case LogType.Debug:
                 log.DebugFormat(message, args);
                 break;
             case LogType.Error:
                 log.ErrorFormat(message, args);
                 break;
             case LogType.Fatal:
                 log.FatalFormat(message, args);
                 break;
             case LogType.Info:
                 log.InfoFormat(message, args);
                 break;
             case LogType.Warn:
                 log.WarnFormat(message, args);
                 break;
         }
     }
     catch (Exception e)
     {
         log.WarnFormat(e.Message);
     }
 }
开发者ID:junaid-git,项目名称:TicketAllocater,代码行数:28,代码来源:TraceLogger.cs

示例15: Log

 public static void Log(this object e, string logMessage = "", LogType type = LogType.SystemLog, string defaultSchema = "system", int severityLevel = 0)
 {
     if (_logSeverityLevel == -1) _logSeverityLevel = new AppConfig<ApplicationConfiguration>().GetConfigValue<int>("LogSeverityLevel");
     if ((e as Exception) != null) type = LogType.ExceptionLog;
     else if ((e as string) != null) logMessage += e;
     if (severityLevel > _logSeverityLevel) return;
     logMessage = logMessage.Replace("'", "''");
     switch (type)
     {
         case LogType.ExceptionLog:
             var innerException = (Exception)e;
             logMessage += innerException.Message;
             while (innerException.InnerException != null)
             {
                 logMessage += innerException.Message;
                 innerException = innerException.InnerException;
             }
             AppLogger.Error(logMessage);
             break;
         case LogType.SystemLog:
             AppLogger.Info(logMessage);
             break;
         case LogType.ScheduledLog:
             DAL.DefaultDb.ExecuteNonQuery(CommandType.Text, string.Format(Resources.Resources.LogScript_sql, defaultSchema, (int)type, logMessage));
             AppLogger.Info(logMessage);
             break;
     }
 }
开发者ID:Tarique-se,项目名称:Archives,代码行数:28,代码来源:ObjectExtensions.cs


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