forked from quic-go/quic-go
Read the initial log level from the QUIC_GO_LOG_LEVEL env if present
We deliberately ignore any parsing errors. Fixes #501.
This commit is contained in:
@@ -60,4 +60,21 @@ var _ = Describe("Log", func() {
|
||||
SetLogLevel(LogLevelDebug)
|
||||
Expect(Debug()).To(BeTrue())
|
||||
})
|
||||
|
||||
It("reads log level from env", func() {
|
||||
Expect(logLevel).To(Equal(LogLevelNothing))
|
||||
os.Setenv(logEnv, "1")
|
||||
readLoggingEnv()
|
||||
Expect(logLevel).To(Equal(LogLevelDebug))
|
||||
})
|
||||
|
||||
It("does not error reading invalid log levels from env", func() {
|
||||
Expect(logLevel).To(Equal(LogLevelNothing))
|
||||
os.Setenv(logEnv, "")
|
||||
readLoggingEnv()
|
||||
Expect(logLevel).To(Equal(LogLevelNothing))
|
||||
os.Setenv(logEnv, "asdf")
|
||||
readLoggingEnv()
|
||||
Expect(logLevel).To(Equal(LogLevelNothing))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user