added custom logger and SetLogger func

bot-api-6.1
Yan Mihailov 2018-08-07 00:15:37 +03:00
parent 4c16a90966
commit a1b3e41878
3 changed files with 17 additions and 2 deletions

1
bot.go
View File

@ -9,7 +9,6 @@ import (
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"net/url" "net/url"
"os" "os"

View File

@ -1,7 +1,6 @@
package tgbotapi package tgbotapi
import ( import (
"log"
"net/url" "net/url"
) )

17
log.go 100644
View File

@ -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
}