public bool DebugLog(object message, dynamic request = null, string errorCode = "", string identity = "", [CallerFilePath] string fileName = "", [CallerMemberName] string methodName = "", ComponentStatus componentStatus = ComponentStatus.None, LogSeverity logSeverity = LogSeverity.Debug)
        {
            if (!_logging || !_debugLogging)
            {
                return(false);
            }

            try
            {
                DebugLoggerModel debugLoggerModel = new DebugLoggerModel
                {
                    Date     = DateTime.UtcNow,
                    Severity = logSeverity.ToString(),
                    Logger   = _serviceType.ToString(),
                    File     = fileName.ToFileName(),
                    Method   = methodName,
                    Identity = !string.IsNullOrEmpty(identity) ? identity : Convert.ToString(CommonMethods.GetValueFromDynamic(request, "UserID")),

                    Message         = Convert.ToString(message),
                    StackTrace      = null,
                    Exception       = null,
                    ApplicationCode = _applicationCode ?? string.Empty,
                    ErrorCode       = errorCode,
                    MessageData     = request != null?JsonConvert.SerializeObject(request, Formatting.None) : string.Empty,
                                          ComponentStatus = componentStatus != ComponentStatus.None ? componentStatus.ToString() : string.Empty
                };

                return(_eventBus.Publish(debugLoggerModel));
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
示例#2
0
 public static void Log(string message, LogSeverity severity = LogSeverity.Verbose)
 {
     if (severity <= Logger.LoggingLevel)
     {
         Console.WriteLine($"{severity.ToString("g")}:{message}");
     }
 }
示例#3
0
        /// <summary>
        ///  Sends a message to the log.
        /// </summary>
        /// <remarks>
        ///  This should almost never be called directly, but rather through one of the helper functions.
        /// </remarks>
        /// <param name="log_severity">Severity of the log message.</param>
        /// <param name="log_message">Text to write into the log.</param>
        public static void log(LogSeverity log_severity, string log_message)
        {
            if (running == false)
            {
                String formattedMessage = String.Format("!!! {0}|{1}|({2}): {3}",
                                                        DateTime.Now.ToString("MM-dd HH:mm:ss.ffff"),
                                                        log_severity.ToString(),
                                                        Thread.CurrentThread.ManagedThreadId,
                                                        log_message);
                if (consoleOutput)
                {
                    Console.WriteLine(formattedMessage);
                }
                return;
            }

            LogStatement statement = new LogStatement
            {
                threadId = Thread.CurrentThread.ManagedThreadId,
                severity = log_severity,
                message  = log_message,
                time     = DateTime.Now.ToString("MM-dd HH:mm:ss.ffff")
            };

            lock (statements)
            {
                statements.Add(statement);
            }
        }
示例#4
0
		/// <summary>
		/// Logs the specified severity.
		/// </summary>
		/// <param name="severity">The severity.</param>
		/// <param name="message">The message.</param>
		public void Log(LogSeverity severity, string message)
		{
			RequiresNotNull(message);
			var con = factory.OpenConnection();
			con.ContinueWith(pt =>
			{
				var connection = pt.Result;
				try
				{
					var cmd = connection.CreateCommand();
					cmd.CommandText = "INSERT INTO Log (Id, Timestamp, Severity, Message) VALUES (NEWID(), @time, @sev, @msg)";

					var timestampParameter = cmd.CreateParameter();
					timestampParameter.ParameterName = "@time";
					timestampParameter.Value = DateTime.Now;
					cmd.Parameters.Add(timestampParameter);

					var severityParameter = cmd.CreateParameter();
					severityParameter.ParameterName = "@sev";
					severityParameter.Value = severity.ToString();
					cmd.Parameters.Add(severityParameter);

					var messageParameter = cmd.CreateParameter();
					messageParameter.ParameterName = "@msg";
					messageParameter.Value = message;
					cmd.Parameters.Add(messageParameter);

					cmd.ExecuteNonQuery();
				}
				finally
				{
					connection.Dispose();
				}
			});
		}
示例#5
0
 public void Log(LogSeverity severity, string source, Exception exception)
 {
     Console.WriteLine(string.Format("Log : {0} - {1} - {2}", severity.ToString(), source, exception.ToString()));
     if (severity == LogSeverity.Error || severity == LogSeverity.Critical)
     {
         Errors.Add(new KeyValuePair<string, Exception>(source, exception));
     }
 }
示例#6
0
 /// <summary>
 ///     Log a message
 /// </summary>
 /// <param name="severity">The severity</param>
 /// <param name="source">The source</param>
 /// <param name="message">The message</param>
 public void Log(LogSeverity severity, string source, string message)
 {
     if ((int)severity < (int)MinLogSeverity)
     {
         return;
     }
     Console.WriteLine(severity.ToString() + " " + source + " " + message);
 }
示例#7
0
        public void Log(LogSeverity severity, string message, params object[] args)
        {
            LogEventInfo logEvent = new LogEventInfo(LogLevel.FromString(severity.ToString()), "User", string.Format(message, args));

            logEvent.Properties["AgentID"] = AgentId;
            logEvent.Properties["Occured"] = Security.LastTickEvent;
            _loggerUser.Log(logEvent);
        }
示例#8
0
 private void Log(string message, LogSeverity severity = LogSeverity.Info)
 {
     if (severity < _minLogSeverity)
     {
         return;
     }
     Console.WriteLine("Song Loader [" + severity.ToString().ToUpper() + "]: " + message);
 }
示例#9
0
 public void Log(string message, LogSeverity severity, Exception exception)
 {
     Console.WriteLine($"[bond] {severity.ToString().ToUpper()}: {message}");
     if (exception != null)
     {
         Console.WriteLine(exception);
     }
 }
示例#10
0
 public void Log(string message, LogSeverity severity, Exception exception)
 {
     Console.WriteLine($"[bond] {severity.ToString().ToUpper()}: {message}");
     if (exception != null)
     {
         Console.WriteLine(exception);
     }
 }
        /// <excludedoc />
        protected override void LogImpl(LogSeverity severity, string message, ExceptionData exceptionData)
        {
            message = String.Format("[{0}] {1}", severity.ToString().ToLowerInvariant(), message);

            if (exceptionData != null)
                writer.WriteException(exceptionData, message);
            else
                writer.WriteLine(message);
        }
示例#12
0
 private static void WriteToLog(LogSeverity messageLevel, string logMessage)
 {
     if (messageLevel <= currentLogLevel)
     {
         string log = DateTime.Now + "    " + messageLevel.ToString() + ":" + logMessage;
         Console.WriteLine(log);
         File.AppendAllText("zerog.log", log + Environment.NewLine);
     }
 }
示例#13
0
 private static void LogRecord(LogSeverity level, string message)
 {
     if (level < LogSeverity.LogWarning)
     {
         BuglyAgent.DebugLog(level.ToString(), message, new object[0]);
     }
     BuglyAgent.ConfigCrashReporterPackage();
     try
     {
         BuglyAgent.GameAgent.CallStatic("printLog", new object[]
         {
             string.Format("<{0}> - {1}", level.ToString(), message)
         });
     }
     catch
     {
     }
 }
示例#14
0
 private static void LogRecord(LogSeverity level, string message)
 {
     if (level < LogSeverity.LogWarning)
     {
         BuglyAgent.DebugLog(level.ToString(), message, new object[0]);
         return;
     }
     try
     {
         BuglyAgent.UnityAgent.Call("printLog", new object[]
         {
             string.Format("<{0}> - {1}", level.ToString(), message)
         });
     }
     catch
     {
     }
 }
示例#15
0
        /// <summary>Returns a string that represents the current object.</summary>
        /// <returns>A string that represents the current object.</returns>
        public override string ToString()
        {
            string output = $"[{DateTime.Now}] {TAG.ToUpper()} - '{LogSeverity.ToString()}: {Message}'";

            foreach (KeyValuePair <string, string> additionalField in AdditionalFields)
            {
                output += $" - '{additionalField.Key}' : '{additionalField.Value}'";
            }
            return(output);
        }
示例#16
0
        private static LogSeverity GetLogSeveritySetting(LogSeverity defaultValue)
        {
            if (!Enum.TryParse(Settings.LogSeverity, out LogSeverity result))
            {
                Settings.LogSeverity = defaultValue.ToString();
                result = defaultValue;
            }

            return(result);
        }
示例#17
0
        public static void LogIssue(string message, string issueLocation, DateTime issueTime, LogSeverity severity)
        {
            //TODO: update this to use a config file path
            string path = "~/logs/issue_log" + DateTime.Now.ToString("dd-MM-yyyy") + ".log";

            using (StreamWriter sw = new StreamWriter(path, true))
            {
                sw.WriteLine(issueTime.ToString("hh:mm:ss") + " [" + severity.ToString() + "] @" + issueLocation + " : " + message);
            }
        }
示例#18
0
        public static Task Log(string msg, bool succeeded)
        {
            LogSeverity severity = succeeded ? LogSeverity.Info : LogSeverity.Error;

            HandleLogSeverity(severity);

            Console.WriteLine(BuildLogMessage(severity.ToString(), "Commands", msg));

            Console.ForegroundColor = defColor;
            return(Task.CompletedTask);
        }
示例#19
0
    private static void LogRecord(LogSeverity level, string message)
    {
        if (level < LogSeverity.LogWarning)
        {
            DebugLog(level.ToString(), message);
        }

        ConfigCrashReporterType();

        _BuglyLogMessage(LogSeverityToInt(level), null, message);
    }
示例#20
0
 public static void Log(string msg, LogSeverity severity = LogSeverity.Information)
 {
     if (ConfigurationHelper.GetLogQueueName() != null)
     {
         if (ConfigurationHelper.GetCurrentSeverityLevel().ToLower() == LogSeverity.Information.ToString().ToLower() ||
             (severity.ToString().ToLower() == ConfigurationHelper.GetCurrentSeverityLevel().ToLower()))
         {
             CloudQueueMessage m = new CloudQueueMessage(msg);
             queue.AddMessage(m);
         }
     }
 }
示例#21
0
 public static string ToShortString(this LogSeverity severity)
 {
     return(severity switch
     {
         LogSeverity.Verbose => "VRB",
         LogSeverity.Debug => "DBG",
         LogSeverity.Information => "INF",
         LogSeverity.Warning => "WRN",
         LogSeverity.Error => "ERR",
         LogSeverity.Fatal => "FTL",
         _ => severity.ToString(),
     });
示例#22
0
        public static LogSeverity GetLogSeverity(this Settings settings, LogSeverity defaultValue)
        {
            if (Enum.TryParse(settings.LogSeverity, out LogSeverity result))
            {
                return(result);
            }

            settings.LogSeverity = defaultValue.ToString();
            result = defaultValue;

            return(result);
        }
 public static void Log(string msg,LogSeverity severity=LogSeverity.Information)
 {
     if (ConfigurationHelper.GetLogQueueName() != null)
     {
         if (ConfigurationHelper.GetCurrentSeverityLevel().ToLower() == LogSeverity.Information.ToString().ToLower()
             || (severity.ToString().ToLower() == ConfigurationHelper.GetCurrentSeverityLevel().ToLower()))
         {
             CloudQueueMessage m = new CloudQueueMessage(msg);
             queue.AddMessage(m);
         }                
     }            
 }
示例#24
0
    private static void LogToConsole(LogSeverity level, string message)
    {
        if (!_debugMode && LogSeverity.Log != level)
        {
            if (level < LogSeverity.LogInfo)
            {
                return;
            }
        }

        UnityEngine.Debug.LogWarning(string.Format("[BuglyAgent] <{0}> - {1}", level.ToString(), message));
    }
示例#25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NlogManager" /> class.
        /// </summary>
        /// <param name="logDirectory">The log directory.</param>
        /// <param name="logFileNamePrefix">The log file name prefix.</param>
        public NlogManager(string logDirectory, string logFileNamePrefix, LogSeverity initialSeverity) : this(logDirectory, logFileNamePrefix)
        {
            _severity = initialSeverity;

            DebugFileWriter(
                logDirectory, String.Format(
                    "NlogManager constructor called, logDirectory is [{0}], logFileNamePrefix is [{1}], _severity is [{2}].",
                    logDirectory,
                    logFileNamePrefix,
                    _severity.ToString()
                    ));
        }
示例#26
0
        public void Log(string message, LogSeverity severity)
        {
            string fmat = $"{severity.ToString().ToUpper()}\t{message}";

            if (_stdoutPred.Any(x => x(message, severity)))
            {
                _stdout.WriteLine(fmat);
            }
            if (_stderrPred.Any(x => x(message, severity)))
            {
                _stderr.WriteLine(fmat);
            }
        }
示例#27
0
        /// <excludedoc />
        protected override void LogImpl(LogSeverity severity, string message, ExceptionData exceptionData)
        {
            message = String.Format("[{0}] {1}", severity.ToString().ToLowerInvariant(), message);

            if (exceptionData != null)
            {
                writer.WriteException(exceptionData, message);
            }
            else
            {
                writer.WriteLine(message);
            }
        }
示例#28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NlogManager" /> class.
        /// </summary>
        /// <param name="logDirectory">The log directory.</param>
        /// <param name="logFileNamePrefix">The log file name prefix.</param>
        public NlogManager(string logDirectory, string logFileNamePrefix)
        {
            DebugFileWriter(
                logDirectory, String.Format(
                    "NlogManager constructor called, logDirectory is [{0}], logFileNamePrefix is [{1}], _severity is [{2}].",
                    logDirectory,
                    logFileNamePrefix,
                    _severity.ToString()
                    ));

            LogDirectory  = logDirectory;
            LogFilePrefix = logFileNamePrefix;

            LogManager.Configuration = new LoggingConfiguration();
        }
示例#29
0
    private static void LogToConsole(LogSeverity level, string message)
    {
        if (!_debugMode && LogSeverity.Log != level)
        {
            if (level < LogSeverity.LogInfo)
            {
                return;
            }
        }

        try {
            UnityAgent.Call("printLog", string.Format("[BuglyAgent] <{0}> - {1}", level.ToString(), message));
        } catch {
        }
    }
示例#30
0
        public void Handle(LogSeverity severity, Exception exception, String format, params object[] args)
        {
            if (severity < LogSeverity.Information)
            {
                return;
            }

            var message = string.Format(format, args);

            Console.WriteLine($"[bond] {severity.ToString().ToUpper()}: {message}");
            if (exception != null)
            {
                Console.WriteLine(exception);
            }
        }
示例#31
0
            // Internal log function called by the log thread
            private static void log_internal(LogSeverity severity, string message, int threadId, string time)
            {
                try
                {
                    if (severity >= currentSeverity)
                    {
                        String formattedMessage = String.Format("{0}|{1}|({2}): {3}",
                                                                time,
                                                                severity.ToString(),
                                                                threadId,
                                                                message);

                        if (consoleOutput)
                        {
                            if (severity == LogSeverity.error)
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                            }

                            Console.WriteLine(formattedMessage);

                            if (severity == LogSeverity.error)
                            {
                                Console.ResetColor();
                            }
                        }

                        Debug.WriteLine(formattedMessage);

                        lock (logfilename)
                        {
                            Logging.roll();
                            byte[] logMessage = Encoding.UTF8.GetBytes(formattedMessage + Environment.NewLine);
                            logFileStream.Write(logMessage, 0, logMessage.Length);
                            logFileStream.Flush();
                            currentLogSize += logMessage.Length;
                        }
                    }
                }
                catch (Exception e)
                {
                    if (consoleOutput)
                    {
                        Console.WriteLine("Logging exception: {0}", e.Message);
                    }
                }
            }
示例#32
0
    private static void LogToConsole(LogSeverity level, string message)
    {
        if (!_debugMode && LogSeverity.Log != level)
        {
            if (level < LogSeverity.LogWarning)
            {
                return;
            }
        }

        if (_debugMode)
        {
            Console.WriteLine("[BuglyAgent] <{0}> - {1}", level.ToString(), message);
        }

        _BuglyLogMessage(LogSeverityToInt(level), null, message);
    }
示例#33
0
 public LogEntry(
     string username,
     LogSeverity severity,
     string message,
     string stackTrace,
     string machineName,
     string applicationName,
     DateTime dateTime)
 {
     Username        = username;
     Severity        = severity.ToString();
     Message         = message;
     StackTrace      = stackTrace;
     MachineName     = machineName;
     ApplicationName = applicationName;
     DateTime        = dateTime;
 }
示例#34
0
        private static string Message(string source, string message, LogSeverity severity)
        {
            var lines = new List <string[]>
            {
                new[]
                {
                    string.Format("{0:dd/MM/yyyy HH:mm:ss}", DateTime.UtcNow),
                    "[" + source + "]",
                    "[" + severity.ToString()[0] + "]",
                    message ?? ""
                }
            };

            var prettied = lines.PrettyLines(2);

            Console.ForegroundColor = severity.SeverityToColor();

            return(prettied);
        }
        internal static bool GetIsLoggingEnabled(Log log, LogSeverity severity)
        {
            switch (severity)
            {
            case LogSeverity.VERBOSE: return(log.IsVerboseEnabled);

            case LogSeverity.DEBUG: return(log.IsDebugEnabled);

            case LogSeverity.INFO: return(log.IsInfoEnabled);

            case LogSeverity.WARNING: return(log.IsWarnEnabled);

            case LogSeverity.FATAL: return(log.IsFatalEnabled);

            case LogSeverity.ERROR: return(log.IsErrorEnabled);

            default:
                throw new InvalidOperationException("Unsupported log severity: " + severity.ToString());
            }
        }
        private static Action <string> GetLogMessageMethod(Log log, LogSeverity logSeverity)
        {
            switch (logSeverity)
            {
            case LogSeverity.VERBOSE: return(log.Verbose);

            case LogSeverity.DEBUG: return(log.Debug);

            case LogSeverity.INFO: return(log.Info);

            case LogSeverity.WARNING: return(log.Warn);

            case LogSeverity.FATAL: return(log.Fatal);

            case LogSeverity.ERROR: return(log.Error);

            default:
                throw new InvalidOperationException("Unsupported log severity: " + logSeverity.ToString());
            }
        }
示例#37
0
        /// <summary>
        /// Writes to the log.
        /// </summary>
        /// <param name="level">Severity of the log.</param>
        /// <param name="text">Actual (formattable) text.</param>
        /// <param name="args">string.Format arguments.</param>
        public void Write(LogSeverity level, string text, params string[] args)
        {
            if (args.Length > 0) {
                text = string.Format(text, args);
            }

            string[] split = text.Split('\n');

            if (split.Length > 1) {
                foreach (string part in split) {
                    Write(level, part);
                }
                return;
            }

            string line = string.Format(Format, new string[3] {
                DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                level.ToString().PadLeft(8),
                text
            });

            LogFile.WriteLine(line);

            LogEntry logEntry = new LogEntry {
                Text = text,
                Instance = InstanceName,
                Level = level,
                Line = line
            };

            (new Thread(() => {
                foreach (Action<LogEntry> action in LogWrite) {
                    action.Invoke(logEntry);
                }
            })).Start();
        }
示例#38
0
 /// <summary>
 /// Formats the log message.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="severity">The severity.</param>
 /// <param name="messageToken">The message token.</param>
 /// <param name="source">The source.</param>
 /// <returns>System.String.</returns>
 private static string FormatLogMessage(string message, LogSeverity severity, string messageToken = "", string source = "")
 {
     return string.Format(CultureInfo.InvariantCulture, "{0} | {1} | {2} | {3} | {4}{5}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture), severity.ToString().ToUpper(CultureInfo.InvariantCulture), message, source, messageToken, Environment.NewLine);
 }
示例#39
0
 public string Format(LogSeverity severity, string message)
 {
     return string.Format("{0} [{1}]: {2}", DateTime.Now, 
         severity.ToString(), message);
 }
示例#40
0
 private void OnLog(LogSeverity arg1, string arg2)
 {
     if (arg1 == LogSeverity.Error || arg1 == LogSeverity.Fatal)
     {
         WriteLine("{0}: {1}", arg1.ToString().ToUpper(), arg2);
     }
     else
     {
         WriteLine("{0}: {1}", arg1.ToString().ToUpper(), arg2);
     }
 }
示例#41
0
        private static string GetSeverityText(LogSeverity severity)
        {
            if (severity == LogSeverity.Default || severity == LogSeverity.Debug)
            return "";

              if (severity == LogSeverity.Notice)
            return "***";

              return severity.ToString().ToUpper();
        }
示例#42
0
 private static void LogToConsole(LogSeverity level, string message)
 {
     if (!BuglyAgent._debugMode && level != LogSeverity.Log && level < LogSeverity.LogInfo)
     {
         return;
     }
     try
     {
         BuglyAgent.UnityAgent.Call("printLog", new object[]
         {
             string.Format("[BuglyAgent] <{0}> - {1}", level.ToString(), message)
         });
     }
     catch
     {
     }
 }
示例#43
0
 private static void _HandleException(LogSeverity logLevel, string name, string message, string stackTrace, bool uncaught)
 {
     if (!BuglyAgent.IsInitialized)
     {
         BuglyAgent.PrintLog(LogSeverity.Log, "It has not been initialized.", new object[0]);
         return;
     }
     if (logLevel == LogSeverity.Log)
     {
         return;
     }
     if (uncaught && logLevel < BuglyAgent._autoReportLogLevel)
     {
         BuglyAgent.PrintLog(LogSeverity.Log, "Not report exception for level {0}", new object[]
         {
             logLevel.ToString()
         });
         return;
     }
     string text = null;
     string text2 = null;
     if (!string.IsNullOrEmpty(message))
     {
         try
         {
             if (logLevel == LogSeverity.LogException && message.Contains("Exception"))
             {
                 Match match = new Regex("^(?<errorType>\\S+):\\s*(?<errorMessage>.*)").Match(message);
                 if (match.Success)
                 {
                     text = match.Groups["errorType"].Value;
                     text2 = match.Groups["errorMessage"].Value.Trim();
                 }
             }
         }
         catch
         {
         }
         if (string.IsNullOrEmpty(text2))
         {
             text2 = message;
         }
     }
     if (string.IsNullOrEmpty(name))
     {
         if (string.IsNullOrEmpty(text))
         {
             text = string.Format("Unity{0}", logLevel.ToString());
         }
     }
     else
     {
         text = name;
     }
     BuglyAgent._reportException(uncaught, text, text2, stackTrace);
 }
 private static string GetCaption(LogSeverity severity)
 {
     return severity.ToString().ToUpperInvariant();
 }
示例#45
0
 /// <summary>
 /// Gets the log level.
 /// </summary>
 /// <param name="severity">The severity.</param>
 /// <returns>NLog.LogLevel.</returns>
 private NLog.LogLevel GetLogLevel(LogSeverity severity)
 {
     switch (severity)
     {
         case LogSeverity.Debug:
             return NLog.LogLevel.Debug;
         case LogSeverity.Error:
             return NLog.LogLevel.Error;
         case LogSeverity.Warn:
             return NLog.LogLevel.Warn;
         case LogSeverity.Fatal:
             return NLog.LogLevel.Fatal;
         case LogSeverity.Info:
             return NLog.LogLevel.Info;
         default:
             throw new ArgumentException("Unknown LogSeverity: " + severity.ToString());
     }
 }
示例#46
0
 /// <summary>Retrieves a CSS class for the given severity level.</summary>
 /// <param name="severity">The severity of the log message.</param>
 public static string SeverityClass(LogSeverity severity)
 {
     return string.Format("{0}_{1}", RootClass, severity.ToString());
 }
示例#47
0
	private static void LogToConsole(LogSeverity level, string message){
	
		if (!_debugMode && LogSeverity.Log != level) {
			if (level < LogSeverity.LogInfo) {
				return;
			}
		}

		try {
			UnityAgent.Call ("printLog", string.Format ("[BuglyAgent] <{0}> - {1}", level.ToString (), message));
		} catch {
			
		}
	}
示例#48
0
	private static void _HandleException (LogSeverity logLevel, string name, string message, string stackTrace, bool uncaught)
	{
		if (!IsInitialized) {
			PrintLog (LogSeverity.Log, "It has not been initialized.");
			return;
		}

		if (logLevel == LogSeverity.Log) {
			return;
		}

		if ((uncaught && logLevel < _autoReportLogLevel)) {
			PrintLog (LogSeverity.Log, "Not report exception for level {0}", logLevel.ToString ());
			return;
		}

		string type = null;
		string reason = null;

		if (!string.IsNullOrEmpty (message)) {
			try {
				if ((LogSeverity.LogException == logLevel) && message.Contains ("Exception")) {
					Match match = new Regex (@"^(?<errorType>\S+):\s*(?<errorMessage>.*)").Match (message);
						
					if (match.Success) {
						type = match.Groups ["errorType"].Value;
						reason = match.Groups ["errorMessage"].Value.Trim ();
					}
				}
			} catch {

			}

			if (string.IsNullOrEmpty (reason)) {
				reason = message;
			}
		}

		if (string.IsNullOrEmpty (name)) {
			if (string.IsNullOrEmpty (type)) {
				type = string.Format ("Unity{0}", logLevel.ToString ());
			}
		} else {
			type = name;
		}
	
		_reportException (uncaught, type, reason, stackTrace);
	}
示例#49
0
	private static void LogToConsole(LogSeverity level, string message){
		if (!_debugMode && LogSeverity.Log != level) {
			if (level < LogSeverity.LogInfo) {
				return;
			}
		}

		UnityEngine.Debug.LogWarning (string.Format("[BuglyAgent] <{0}> - {1}", level.ToString(), message));
	}