From 40ba5659750ad8924718acd90939704b05becd73 Mon Sep 17 00:00:00 2001 From: MisterWil Date: Fri, 12 Apr 2019 09:48:21 -0700 Subject: [PATCH] Requested changes --- CHANGELOG.md | 2 +- logging_handler_test.go | 2 +- options.go | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e90d081..2c599ce3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Vx.x.x (Pre-release) ## Changes since v3.2.0 -- [#52](https://github.com/pusher/oauth2_proxy/pull/52) Logging Improvements +- [#52](https://github.com/pusher/oauth2_proxy/pull/52) Logging Improvements (@MisterWil) - Implement flags to configure file logging - `-logging-filename` Defines the filename to log to - `-logging-max-size` Defines the maximum diff --git a/logging_handler_test.go b/logging_handler_test.go index add61953..f92c7e0d 100644 --- a/logging_handler_test.go +++ b/logging_handler_test.go @@ -19,7 +19,7 @@ func TestLoggingHandler_ServeHTTP(t *testing.T) { Format, ExpectedLogMessage string }{ - {defaultRequestLoggingFormat, fmt.Sprintf("127.0.0.1 - - [%s] test-server GET - \"/foo/bar\" HTTP/1.1 \"\" 200 4 0", ts.Format("02/Jan/2006:15:04:05 -0700"))}, + {logger.DefaultRequestLoggingFormat, fmt.Sprintf("127.0.0.1 - - [%s] test-server GET - \"/foo/bar\" HTTP/1.1 \"\" 200 4 0.000\n", logger.FormatTimestamp(ts))}, {"{{.RequestMethod}}", "GET\n"}, } diff --git a/options.go b/options.go index 4b30f69d..114869f1 100644 --- a/options.go +++ b/options.go @@ -87,18 +87,18 @@ type Options struct { ApprovalPrompt string `flag:"approval-prompt" cfg:"approval_prompt" env:"OAUTH2_PROXY_APPROVAL_PROMPT"` // Configuration values for logging - LoggingFilename string `flag:"logging-filename" cfg:"logging_filename"` - LoggingMaxSize int `flag:"logging-max-size" cfg:"logging_max_size"` - LoggingMaxAge int `flag:"logging-max-age" cfg:"logging_max_age"` - LoggingMaxBackups int `flag:"logging-max-backups" cfg:"logging_max_backups"` - LoggingLocalTime bool `flag:"logging-local-time" cfg:"logging_local_time"` - LoggingCompress bool `flag:"logging-compress" cfg:"logging_compress"` - StandardLogging bool `flag:"standard-logging" cfg:"standard_logging"` - StandardLoggingFormat string `flag:"standard-logging-format" cfg:"standard_logging_format"` - RequestLogging bool `flag:"request-logging" cfg:"request_logging"` - RequestLoggingFormat string `flag:"request-logging-format" cfg:"request_logging_format"` - AuthLogging bool `flag:"auth-logging" cfg:"auth_logging"` - AuthLoggingFormat string `flag:"auth-logging-format" cfg:"auth_logging_format"` + LoggingFilename string `flag:"logging-filename" cfg:"logging_filename" env:"OAUTH2_LOGGING_FILENAME"` + LoggingMaxSize int `flag:"logging-max-size" cfg:"logging_max_size" env:"OAUTH2_LOGGING_MAX_SIZE"` + LoggingMaxAge int `flag:"logging-max-age" cfg:"logging_max_age" env:"OAUTH2_LOGGING_MAX_AGE"` + LoggingMaxBackups int `flag:"logging-max-backups" cfg:"logging_max_backups" env:"OAUTH2_LOGGING_MAX_BACKUPS"` + LoggingLocalTime bool `flag:"logging-local-time" cfg:"logging_local_time" env:"OAUTH2_LOGGING_LOCAL_TIME"` + LoggingCompress bool `flag:"logging-compress" cfg:"logging_compress" env:"OAUTH2_LOGGING_COMPRESS"` + StandardLogging bool `flag:"standard-logging" cfg:"standard_logging" env:"OAUTH2_STANDARD_LOGGING"` + StandardLoggingFormat string `flag:"standard-logging-format" cfg:"standard_logging_format" env:"OAUTH2_STANDARD_LOGGING_FORMAT"` + RequestLogging bool `flag:"request-logging" cfg:"request_logging" env:"OAUTH2_REQUEST_LOGGING"` + RequestLoggingFormat string `flag:"request-logging-format" cfg:"request_logging_format" env:"OAUTH2_REQUEST_LOGGING_FORMAT"` + AuthLogging bool `flag:"auth-logging" cfg:"auth_logging" env:"OAUTH2_LOGGING_AUTH_LOGGING"` + AuthLoggingFormat string `flag:"auth-logging-format" cfg:"auth_logging_format" env:"OAUTH2_AUTH_LOGGING_FORMAT"` SignatureKey string `flag:"signature-key" cfg:"signature_key" env:"OAUTH2_PROXY_SIGNATURE_KEY"` AcrValues string `flag:"acr-values" cfg:"acr_values" env:"OAUTH2_PROXY_ACR_VALUES"`