Skip to content

Commit

Permalink
Merge pull request slack-go#84 from dlsniper/fix-logging
Browse files Browse the repository at this point in the history
Fix debugging and logging
  • Loading branch information
nlopes authored Jun 30, 2016
2 parents c2edeb3 + 6b76b2d commit a7a011b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"log"
"net/url"
"os"
)

var logger *log.Logger // A logger that can be set by consumers
Expand Down Expand Up @@ -69,6 +70,9 @@ func (api *Client) AuthTest() (response *AuthTestResponse, error error) {
// If you ever use this in production, don't call SetDebug(true)
func (api *Client) SetDebug(debug bool) {
api.debug = debug
if debug && logger == nil {
logger = log.New(os.Stdout, "nlopes/slack", log.LstdFlags | log.Lshortfile)
}
}

func (api *Client) Debugf(format string, v ...interface{}) {
Expand Down

0 comments on commit a7a011b

Please sign in to comment.