Example #1
0
        public static void ErrorOccurred(this SegmentSpan span, Exception exception, TracingConfig tracingConfig)
        {
            if (span == null)
            {
                return;
            }

            span.IsError = true;

            if (exception == null)
            {
                return;
            }

            if (tracingConfig == null)
            {
                tracingConfig = new TracingConfig();
            }

            var stackTrace = exception.HasInnerExceptions() ? exception.ToDemystifiedString(tracingConfig.ExceptionMaxDepth) : exception.StackTrace;

            span.AddLog(LogEvent.Event("error"),
                        LogEvent.ErrorKind(exception.GetType().FullName),
                        LogEvent.Message(exception.Message),
                        LogEvent.ErrorStack(stackTrace));
        }
        public static void ErrorOccurred(this SegmentSpan span, Exception exception = null)
        {
            if (span == null)
            {
                return;
            }

            span.IsError = true;
            if (exception != null)
            {
                span.AddLog(LogEvent.Event("error"),
                            LogEvent.ErrorKind(exception.GetType().FullName),
                            LogEvent.Message(exception.Message),
                            LogEvent.ErrorStack(exception.StackTrace));
            }
        }