From 4109b117fe663f36cda3ea4d0e107ff7b4d0a207 Mon Sep 17 00:00:00 2001 From: Steve Biedermann Date: Tue, 9 Nov 2021 17:23:04 +0100 Subject: [PATCH] add quiet flag to disable logging --- main.go | 6 ++++++ server/options.go | 1 + 2 files changed, 7 insertions(+) diff --git a/main.go b/main.go index 41c8839..54e3f90 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "io/ioutil" "os" "os/signal" "strings" @@ -63,6 +64,11 @@ func main() { } } + if appOptions.Quiet { + log.SetFlags(0) + log.SetOutput(ioutil.Discard) + } + utils.ApplyFlags(cliFlags, flagMappings, c, appOptions, backendOptions) if c.IsSet("credential") { diff --git a/server/options.go b/server/options.go index 6652679..24fa515 100644 --- a/server/options.go +++ b/server/options.go @@ -32,6 +32,7 @@ type Options struct { WSOrigin string `hcl:"ws_origin" flagName:"ws-origin" flagDescribe:"A regular expression that matches origin URLs to be accepted by WebSocket. No cross origin requests are acceptable by default" default:""` Term string `hcl:"term" flagName:"term" flagDescribe:"Terminal name to use on the browser, one of xterm or hterm." default:"xterm"` EnableWebGL bool `hcl:"enable_webgl" flagName:"enable-webgl" flagDescribe:"Enable WebGL renderer" default:"true"` + Quiet bool `hcl:"quiet" flagName:"quiet" flagDescribe:"Don't log" default:"false"` TitleVariables map[string]interface{} }