Skip to content

Commit

Permalink
Add -log-no-quotes CLI flag
Browse files Browse the repository at this point in the history
  • Loading branch information
benediktwerner committed Feb 28, 2024
1 parent 73b7ed5 commit 18ce9f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 7 additions & 4 deletions core/cmd/hoverfly/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ var (
database = flag.String("db", inmemoryBackend, "Storage to use - 'boltdb' or 'memory' which will not write anything to disk (DEPRECATED)")
disableCache = flag.Bool("disable-cache", false, "Disable the request/response cache (the cache that sits in front of matching)")

logsFormat = flag.String("logs", "plaintext", "Specify format for logs, options are \"plaintext\" and \"json\"")
logsSize = flag.Int("logs-size", 1000, "Set the amount of logs to be stored in memory")
logsFile = flag.String("logs-file", "hoverfly.log", "Specify log file name for output logs")
logNoColor = flag.Bool("log-no-color", false, "Disable colors for logging")
logsFormat = flag.String("logs", "plaintext", "Specify format for logs, options are \"plaintext\" and \"json\"")
logsSize = flag.Int("logs-size", 1000, "Set the amount of logs to be stored in memory")
logsFile = flag.String("logs-file", "hoverfly.log", "Specify log file name for output logs")
logNoColor = flag.Bool("log-no-color", false, "Disable colors for logging")
logNoQuotes = flag.Bool("log-no-quotes", false, "Disable quoting and escaping of logged fields")

journalSize = flag.Int("journal-size", 1000, "Set the size of request/response journal")
cacheSize = flag.Int("cache-size", 1000, "Set the size of request/response cache")
Expand Down Expand Up @@ -216,6 +217,7 @@ func main() {
log.SetFormatter(&log.TextFormatter{
ForceColors: true,
DisableTimestamp: false,
DisableQuote: *logNoQuotes,
FullTimestamp: true,
DisableColors: *logNoColor,
})
Expand Down Expand Up @@ -281,6 +283,7 @@ func main() {
formatter = &log.TextFormatter{
ForceColors: true,
DisableTimestamp: false,
DisableQuote: *logNoQuotes,
FullTimestamp: true,
DisableColors: true,
}
Expand Down
2 changes: 2 additions & 0 deletions docs/pages/reference/hoverfly/hoverfly.output
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Usage of hoverfly:
Set log level (panic, fatal, error, warn, info or debug) (default "info")
-log-no-color
Disable colors for logging
-log-no-quotes
Disable quoting and escaping of logged fields
-logs string
Specify format for logs, options are "plaintext" and "json" (default "plaintext")
-logs-file string
Expand Down

0 comments on commit 18ce9f9

Please sign in to comment.