From b4b6e0dfcfc92b722cbf211645eaf5fb4bd1a374 Mon Sep 17 00:00:00 2001 From: Benedikt Werner <1benediktwerner@gmail.com> Date: Wed, 28 Feb 2024 22:18:07 +0100 Subject: [PATCH] Add -log-no-quotes CLI flag --- core/cmd/hoverfly/main.go | 11 +++++++---- docs/pages/reference/hoverfly/hoverfly.output | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/cmd/hoverfly/main.go b/core/cmd/hoverfly/main.go index 89c791b8e..d451ec122 100644 --- a/core/cmd/hoverfly/main.go +++ b/core/cmd/hoverfly/main.go @@ -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") @@ -216,6 +217,7 @@ func main() { log.SetFormatter(&log.TextFormatter{ ForceColors: true, DisableTimestamp: false, + DisableQuote: *logNoQuotes, FullTimestamp: true, DisableColors: *logNoColor, }) @@ -281,6 +283,7 @@ func main() { formatter = &log.TextFormatter{ ForceColors: true, DisableTimestamp: false, + DisableQuote: *logNoQuotes, FullTimestamp: true, DisableColors: true, } diff --git a/docs/pages/reference/hoverfly/hoverfly.output b/docs/pages/reference/hoverfly/hoverfly.output index 6dca3d48d..6ff1869e5 100644 --- a/docs/pages/reference/hoverfly/hoverfly.output +++ b/docs/pages/reference/hoverfly/hoverfly.output @@ -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