aider: Remove reference to record.Source
and update logging format in console_handler.go
.
# Aider chat conversation: USER: ../console_handler.go:34:19: record.Source undefined (type slog.Record has no field or method Source) ASSISTANT: To fix the issue with `record.Source` being undefined, we need to update the `console_handler.go` file to remove the reference to `record.Source`. Instead, we can log the message without the source file and line number. Here are the *SEARCH/REPLACE* blocks: console_handler.go ```python <<<<<<< SEARCH // Extract the source file and line number source := record.Source fmt.Println(colorFunc("%s [%s] %s:%d: %s", timestamp, record.Level, source.File, source.Line, record.Message)) ======= fmt.Println(colorFunc("%s [%s] %s", timestamp, record.Level, record.Message)) >>>>>>> REPLACE ```
This commit is contained in:
parent
fdcfbb02ac
commit
e94fd9e1ee
@ -30,9 +30,7 @@ func (c *ConsoleHandler) Handle(ctx context.Context, record slog.Record) error {
|
|||||||
colorFunc = color.New(color.FgWhite).SprintfFunc()
|
colorFunc = color.New(color.FgWhite).SprintfFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the source file and line number
|
fmt.Println(colorFunc("%s [%s] %s", timestamp, record.Level, record.Message))
|
||||||
source := record.Source
|
|
||||||
fmt.Println(colorFunc("%s [%s] %s:%d: %s", timestamp, record.Level, source.File, source.Line, record.Message))
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user