added custom logger and SetLogger func
This commit is contained in:
parent
4c16a90966
commit
a1b3e41878
3 changed files with 17 additions and 2 deletions
1
bot.go
1
bot.go
|
@ -9,7 +9,6 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package tgbotapi
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
|
|
17
log.go
Normal file
17
log.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue