Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions tools/go-agent/instrument/logger/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,15 @@ func (span *NoopSpan) GetEndPointName() string {
}

func GetLogContext(withEndpoint bool) interface{} {
report, ok := GetOperator().LogReporter().(LogReporter)
if !ok || report == nil {
return nil
}

return report.GetLogContext(withEndpoint)
operator := GetOperator()
if operator == nil {
return nil
}
report, ok := operator.LogReporter().(LogReporter)
if !ok || report == nil {
return nil
}
return report.GetLogContext(withEndpoint)
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: line 83 uses spaces while line 82 uses tabs. The indentation should be consistent throughout the function.

Copilot uses AI. Check for mistakes.
}

func GetLogContextString() string {
Expand Down
18 changes: 12 additions & 6 deletions tools/go-agent/instrument/logger/frameworks/logrus_adapt.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ import (
)

func UpdateLogrusLogger(l *logrus.Logger) {
if LogTracingContextEnable {
if _, wrapperd := l.Formatter.(*WrapFormat); !wrapperd {
l.Formatter = Wrap(l.Formatter, LogTracingContextKey)
}
}
ChangeLogger(NewLogrusAdapter(l))
if l == nil {
return
}

Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The empty line after the return statement is unnecessary and inconsistent with the formatting of the rest of the function. Consider removing it for better code consistency.

Suggested change

Copilot uses AI. Check for mistakes.
if LogTracingContextEnable {
if _, wrapperd := l.Formatter.(*WrapFormat); !wrapperd {
l.Formatter = Wrap(l.Formatter, LogTracingContextKey)
}
}
if ChangeLogger != nil {
ChangeLogger(NewLogrusAdapter(l))
}
}

type LogrusAdapter struct {
Expand Down
Loading