Example #1
0
        /// <summary>
        /// Catch Unity logger data and create Backtrace reports for log type that represents exception or error
        /// </summary>
        /// <param name="message">Log message</param>
        /// <param name="stackTrace">Log stack trace</param>
        /// <param name="type">log type</param>
        internal void HandleUnityMessage(string message, string stackTrace, LogType type)
        {
            var unityMessage = new BacktraceUnityMessage(message, stackTrace, type);

            _backtraceLogManager.Enqueue(unityMessage);
            if (Configuration.HandleUnhandledExceptions && unityMessage.IsUnhandledException())
            {
                var exception = new BacktraceUnhandledException(unityMessage.Message, unityMessage.StackTrace);
                SendUnhandledException(exception);
            }
        }
Example #2
0
        /// <summary>
        /// Catch Unity logger data and create Backtrace reports for log type that represents exception or error
        /// </summary>
        /// <param name="message">Log message</param>
        /// <param name="stackTrace">Log stack trace</param>
        /// <param name="type">log type</param>
        internal void HandleUnityMessage(string message, string stackTrace, LogType type)
        {
            if (!Enabled)
            {
                return;
            }
            var unityMessage = new BacktraceUnityMessage(message, stackTrace, type);

            _backtraceLogManager.Enqueue(unityMessage);
            if (Configuration.HandleUnhandledExceptions && unityMessage.IsUnhandledException())
            {
                BacktraceUnhandledException exception = null;
                var invokeSkipApi = true;

                // detect sampling flow
                // we should apply sampling only to unhandled exceptions that are type LogType == Error
                // log type error won't provide full exception information
                if (type == LogType.Error && SamplingShouldSkip())
                {
                    if (SkipReport != null || Configuration.ReportFilterType.HasFlag(ReportFilterType.UnhandledException))
                    {
                        exception = new BacktraceUnhandledException(unityMessage.Message, unityMessage.StackTrace);
                        if (ShouldSkipReport(ReportFilterType.UnhandledException, exception, string.Empty))
                        {
                            return;
                        }
                        invokeSkipApi = false;
                    }
                    else
                    {
                        return;
                    }
                }

                if (exception == null)
                {
                    exception = new BacktraceUnhandledException(unityMessage.Message, unityMessage.StackTrace);
                }

                SendUnhandledException(exception, invokeSkipApi);
            }
        }