all repos — telegram-bot-api @ a1b3e4187891a214fb8d67ed937444145d569d23

Golang bindings for the Telegram Bot API

added custom logger and SetLogger func
Yan Mihailov yanmhlv@gmail.com
Tue, 07 Aug 2018 00:15:37 +0300
commit

a1b3e4187891a214fb8d67ed937444145d569d23

parent

4c16a90966d12d963e19e4df99e7744c191d0e79

3 files changed, 17 insertions(+), 2 deletions(-)

jump to
M bot.gobot.go

@@ -9,7 +9,6 @@ "errors"

"fmt" "io" "io/ioutil" - "log" "net/http" "net/url" "os"
M helpers.gohelpers.go

@@ -1,7 +1,6 @@

package tgbotapi import ( - "log" "net/url" )
A log.go

@@ -0,0 +1,17 @@

+package tgbotapi + +import ( + "os" + "errors" + stdlog "log" +) + +var log = stdlog.New(os.Stderr, "", stdlog.LstdFlags) + +func SetLogger(newLog *stdlog.Logger) error { + if newLog == nil { + return errors.New("logger is nil") + } + log = newLog + return nil +}