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

Remove dependency to github.com/brutella/log #20

Closed
brutella opened this issue May 7, 2015 · 6 comments
Closed

Remove dependency to github.com/brutella/log #20

brutella opened this issue May 7, 2015 · 6 comments

Comments

@brutella
Copy link
Owner

brutella commented May 7, 2015

@eaigner What would be a better way to implement log levels?

@mikejac
Copy link

mikejac commented Sep 4, 2016

Hi,

Dave Cheney has some interesting ideas: http://dave.cheney.net/2015/11/05/lets-talk-about-logging

Kinda like it :-)

/michael

@sgrimee
Copy link

sgrimee commented Sep 28, 2016

regardless of how logging is done, is there a way to suppress VERB when using hc ?

I have tried importing brutella/logs and setting log.Verbose = false in my project but I am still getting the VERB output, which makes it difficult to locate my own debugs?

@brutella
Copy link
Owner Author

brutella commented Oct 1, 2016

@sgrimee This should work

@sgrimee
Copy link

sgrimee commented Oct 2, 2016

@brutella thanks but this does not work for me, if I take your example above and set log.Verbose and log.Info to false I still see both debug levels:

~/go/src/github.com/brutella/hklight (master ✘)✹✭ ᐅ grep -e 'log..*=' hklightd.go
    log.Verbose = false
    log.Info = false
~/go/src/github.com/brutella/hklight (master ✘)✹✭ ᐅ go run hklightd.go
2016/10/02 11:02:29 [INFO] Accessory IP is 10.0.1.200
2016/10/02 11:02:38 [VERB] 10.0.1.240:61606 POST /pair-setup
2016/10/02 11:02:38 [VERB] Create new pair setup controller
2016/10/02 11:02:38 [VERB] <-     B: 333db84bbe506c243df07e28

brutella added a commit that referenced this issue Oct 6, 2016
Log messages are reduced to debug and info log messages.
Info log messages are useful information to the user.
Debug log messages are used for debugging purposes.

Errors messages are now info log messages followed by
a panic call.

By default debug logs are sent to /dev/null. You can enable
debug logs by calling log.Debug.Enable() once. #20
@brutella
Copy link
Owner Author

brutella commented Oct 6, 2016

There are now 2 log levels: info and debug.

Info messages are messages for the user. Debug messages are messages for the developer.
By default the debug log level is disabled, which means that those logs are written to /dev/null.

You can enable the debug log level like this:

import "github.com/brutella/hc/log"

log.Debug.Enable()

@brutella brutella closed this as completed Oct 6, 2016
@sgrimee
Copy link

sgrimee commented Oct 6, 2016

This works great, thank you Matthias!

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

3 participants