[tor-commits] [pluggable-transports/snowflake] 02/02: proxy: Let verbose level act on file logging

gitolite role git at cupani.torproject.org
Wed Nov 16 18:11:07 UTC 2022


This is an automated email from the git hooks/post-receive script.

itchyonion pushed a commit to branch main
in repository pluggable-transports/snowflake.

commit 9d72b30603e644b8cf0645ab8da189814c093650
Author: itchyonion <itchyonion at torproject.org>
AuthorDate: Tue Nov 8 13:22:51 2022 -0800

    proxy: Let verbose level act on file logging
---
 proxy/main.go | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/proxy/main.go b/proxy/main.go
index ea8f427..3dad5a9 100644
--- a/proxy/main.go
+++ b/proxy/main.go
@@ -80,12 +80,12 @@ func main() {
 		AllowNonTLSRelay:       *allowNonTLSRelay,
 	}
 
-	var logOutput io.Writer = os.Stderr
+	var logOutput = ioutil.Discard
 	var eventlogOutput io.Writer = os.Stderr
 	log.SetFlags(log.LstdFlags | log.LUTC)
 
-	if !*verboseLogging {
-		logOutput = ioutil.Discard
+	if *verboseLogging {
+		logOutput = os.Stderr
 	}
 
 	if *logFilename != "" {
@@ -94,9 +94,12 @@ func main() {
 			log.Fatal(err)
 		}
 		defer f.Close()
-		logOutput = io.MultiWriter(logOutput, f)
+		if *verboseLogging {
+			logOutput = io.MultiWriter(logOutput, f)
+		}
 		eventlogOutput = io.MultiWriter(eventlogOutput, f)
 	}
+
 	if *unsafeLogging {
 		log.SetOutput(logOutput)
 	} else {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list