allow skipping callstack in errors and events
This commit is contained in:
		@@ -47,6 +47,11 @@ func (e Event) AsOpts() trace.EventOption {
 | 
				
			|||||||
	return trace.WithAttributes(e.IntoTraceAttributes()...)
 | 
						return trace.WithAttributes(e.IntoTraceAttributes()...)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (e Event) SkipMoreInCallStack(skip int) Event {
 | 
				
			||||||
 | 
						e.extraSkipInStack += skip
 | 
				
			||||||
 | 
						return e
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func NewInSpan[E IntoEvent](ev E, span trace.Span) {
 | 
					func NewInSpan[E IntoEvent](ev E, span trace.Span) {
 | 
				
			||||||
	event := ev.IntoEvent()
 | 
						event := ev.IntoEvent()
 | 
				
			||||||
	event.extraSkipInStack += 1
 | 
						event.extraSkipInStack += 1
 | 
				
			||||||
@@ -93,6 +98,11 @@ func (e Error) AsOpts() trace.EventOption {
 | 
				
			|||||||
	return trace.WithAttributes(e.IntoTraceAttributes()...)
 | 
						return trace.WithAttributes(e.IntoTraceAttributes()...)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (e Error) SkipMoreInCallStack(skip int) Error {
 | 
				
			||||||
 | 
						e.extraSkipInStack += skip
 | 
				
			||||||
 | 
						return e
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func NewErrInSpan[E IntoErrorEvent](err E, span trace.Span) E {
 | 
					func NewErrInSpan[E IntoErrorEvent](err E, span trace.Span) E {
 | 
				
			||||||
	er := err.IntoErrorEvent()
 | 
						er := err.IntoErrorEvent()
 | 
				
			||||||
	er.extraSkipInStack += 1
 | 
						er.extraSkipInStack += 1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,10 +79,10 @@ func NewProcessor(opts ProcessorOptions) trace.SpanProcessor {
 | 
				
			|||||||
		fmt := NewPrettyMultilineFormatter()
 | 
							fmt := NewPrettyMultilineFormatter()
 | 
				
			||||||
		formatter = fmt
 | 
							formatter = fmt
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if opts.FilterOnLevel != 0 {
 | 
						if opts.FilterOnLevel != level.SeverityLevel(0) {
 | 
				
			||||||
		lvl = opts.FilterOnLevel
 | 
							lvl = opts.FilterOnLevel
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		lvl = level.TRACE + 10
 | 
							lvl = level.TRACE + 1
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return &Processor{
 | 
						return &Processor{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,7 +77,7 @@ func FromString(level string) SeverityLevel {
 | 
				
			|||||||
	case "TRACE":
 | 
						case "TRACE":
 | 
				
			||||||
		return TRACE
 | 
							return TRACE
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		return CRIT
 | 
							return unset
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user