Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress output #19

Open
sebastianrath opened this issue Nov 30, 2022 · 2 comments
Open

Suppress output #19

sebastianrath opened this issue Nov 30, 2022 · 2 comments

Comments

@sebastianrath
Copy link

I came across this repo through getlantern/systray. My app requires a clean stdout but the following tracing logger info is always printed:

golog/golog.go

Lines 277 to 284 in 49749a7

l.traceOn = shouldEnableTrace(prefix)
if l.traceOn {
fmt.Printf("TRACE logging is enabled for prefix [%s]\n", prefix)
l.traceOut = l.newTraceWriter()
} else {
fmt.Printf("TRACE logging is NOT enabled for prefix [%s]\n", prefix)
l.traceOut = ioutil.Discard
}

Executed through getlantern/systray/systray.go#L16:

var (
	log = golog.LoggerFor("systray")
        [...]

Happy to offer a PR. Any preferences on how to suppress the output? E.g. env var.

Best, Sebastian

@alexg-axis
Copy link

It would be nice if it could use the logger itself instead of fmt.Printf so that it can be controlled by using golog.SetOutput or golog.SetOutputs.

@alexg-axis
Copy link

Turns out that wouldn't be a solution either as, you wrote, the log is printed immediately upon inclusion. That way, there's no chance for others to configure the logging. I suggest that it's removed altogether or rewritten in a way that would allow for configuration of the logs beforehand.

Workaround:

require (
  github.com/getlantern/golog v0.0.0
  // ...
)

replace github.com/getlantern/golog => github.com/alexg-axis/golog v0.0.0-20221212110745-eb1db7fd29e5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants