Logging: fix robots not showing client into
This commit is contained in:
parent
15f1838aa8
commit
4931c51a61
|
@ -10,6 +10,10 @@ import (
|
|||
)
|
||||
|
||||
func robotsTXT(ctx *fasthttp.RequestCtx) {
|
||||
slog := log.With().
|
||||
Str("USERAGENT", string(ctx.UserAgent())).
|
||||
Str("REMOTE_ADDR", remoteAddr).
|
||||
Interface("URL", string(ctx.RequestURI())).Logger()
|
||||
paths := &strings.Builder{}
|
||||
paths.WriteString("User-agent: *\r\n")
|
||||
for _, p := range config.Paths {
|
||||
|
@ -19,11 +23,11 @@ func robotsTXT(ctx *fasthttp.RequestCtx) {
|
|||
}
|
||||
paths.WriteString("\r\n")
|
||||
|
||||
log.Debug().
|
||||
slog.Debug().
|
||||
Strs("PATHS", config.Paths).
|
||||
Msg("SERVE_ROBOTS")
|
||||
|
||||
if _, err := fmt.Fprintf(ctx, paths.String()); err != nil {
|
||||
log.Error().Err(err).Msg("SERVE_ROBOTS_ERROR")
|
||||
slog.Error().Err(err).Msg("SERVE_ROBOTS_ERROR")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue