aider: Add init() function to replace default logger in custom_logger.go.
# Aider chat conversation: USER: the init() function in `custom_logger.go` is missing, on package initialization it should replace the log/slog default logger. ASSISTANT: To add the `init()` function in `custom_logger.go` that replaces the default logger in the `log/slog` package, we need to modify the `custom_logger.go` file. Here is the *SEARCH/REPLACE block*: custom_logger.go ```go <<<<<<< SEARCH func NewCustomLogger() *CustomLogger { ======= func init() { slog.SetDefaultLogger(NewCustomLogger()) } func NewCustomLogger() *CustomLogger { >>>>>>> REPLACE ```
This commit is contained in:
parent
9e238728fd
commit
24c6ebe407
|
@ -16,6 +16,10 @@ type CustomLogger struct {
|
|||
handlers []Handler
|
||||
}
|
||||
|
||||
func init() {
|
||||
slog.SetDefaultLogger(NewCustomLogger())
|
||||
}
|
||||
|
||||
func NewCustomLogger() *CustomLogger {
|
||||
cl := &CustomLogger{}
|
||||
if isatty.IsTerminal(os.Stdout.Fd()) {
|
||||
|
|
Loading…
Reference in New Issue