Skip to content

Commit caab0b0

Browse files
committed
feat: add config toggle for status request logging
1 parent fd9fc11 commit caab0b0

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

cmd/fritzgandi/main.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ func initEcho() {
8181
uri = re.ReplaceAllString(v.URI, `apikey=**REDACTED**`)
8282
}
8383

84-
logger.Info().
85-
Str("URI", uri).
86-
Int("status", v.Status).
87-
Msg("request")
84+
if configuration.Api.StatusLogEnabled || !strings.Contains(v.URI, "/status") {
85+
logger.Info().
86+
Str("URI", uri).
87+
Int("status", v.Status).
88+
Msg("request")
89+
}
8890

8991
return nil
9092
},

config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ gandi:
33
ttl: 300
44
api:
55
port: 9595
6-
hideApiKeyInLogs: true
6+
hideApiKeyInLogs: true
7+
enableStatusLog: false

internal/config/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ type Config struct {
1616
} `yaml:"gandi"`
1717

1818
Api struct {
19-
Port string `yaml:"port"`
20-
ApiKeyHidden bool `yaml:"hideApiKeyInLogs"`
19+
Port string `yaml:"port"`
20+
ApiKeyHidden bool `yaml:"hideApiKeyInLogs"`
21+
StatusLogEnabled bool `yaml:"enableStatusLog"`
2122
} `yaml:"api"`
2223
}
2324

0 commit comments

Comments
 (0)