Add 'log-requests' option to disable request logging (#199)
This commit is contained in:
parent
257e87f76f
commit
8a21dad603
1 changed files with 4 additions and 1 deletions
3
main.go
3
main.go
|
@ -29,6 +29,7 @@ var (
|
||||||
cfg struct {
|
cfg struct {
|
||||||
Customize string `flag:"customize" default:"" description:"Customize-File to load"`
|
Customize string `flag:"customize" default:"" description:"Customize-File to load"`
|
||||||
Listen string `flag:"listen" default:":3000" description:"IP/Port to listen on"`
|
Listen string `flag:"listen" default:":3000" description:"IP/Port to listen on"`
|
||||||
|
LogRequests bool `flag:"log-requests" default:"true" description:"Enable request logging"`
|
||||||
LogLevel string `flag:"log-level" default:"info" description:"Set log level (debug, info, warning, error)"`
|
LogLevel string `flag:"log-level" default:"info" description:"Set log level (debug, info, warning, error)"`
|
||||||
SecretExpiry int64 `flag:"secret-expiry" default:"0" description:"Maximum expiry of the stored secrets in seconds"`
|
SecretExpiry int64 `flag:"secret-expiry" default:"0" description:"Maximum expiry of the stored secrets in seconds"`
|
||||||
StorageType string `flag:"storage-type" default:"mem" description:"Storage to use for putting secrets to" validate:"nonzero"`
|
StorageType string `flag:"storage-type" default:"mem" description:"Storage to use for putting secrets to" validate:"nonzero"`
|
||||||
|
@ -138,7 +139,9 @@ func main() {
|
||||||
|
|
||||||
var hdl http.Handler = r
|
var hdl http.Handler = r
|
||||||
hdl = http_helpers.GzipHandler(hdl)
|
hdl = http_helpers.GzipHandler(hdl)
|
||||||
|
if cfg.LogRequests {
|
||||||
hdl = http_helpers.NewHTTPLogHandlerWithLogger(hdl, logrus.StandardLogger())
|
hdl = http_helpers.NewHTTPLogHandlerWithLogger(hdl, logrus.StandardLogger())
|
||||||
|
}
|
||||||
|
|
||||||
server := &http.Server{
|
server := &http.Server{
|
||||||
Addr: cfg.Listen,
|
Addr: cfg.Listen,
|
||||||
|
|
Loading…
Reference in a new issue