1
4
mirror of https://github.com/yunginnanet/HellPot synced 2024-06-24 23:08:03 +00:00

Logging: fix robots not showing client into

This commit is contained in:
kayos@tcp.direct 2023-01-03 09:37:12 -08:00
parent 15f1838aa8
commit 4931c51a61
Signed by: kayos
GPG Key ID: 4B841471B4BEE979

@ -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")
}
}