diff options
Diffstat (limited to 'telegabber.go')
-rw-r--r-- | telegabber.go | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/telegabber.go b/telegabber.go index e316aa6..8db6077 100644 --- a/telegabber.go +++ b/telegabber.go @@ -12,10 +12,11 @@ import ( "dev.narayana.im/narayana/telegabber/xmpp" log "github.com/sirupsen/logrus" + "github.com/zelenin/go-tdlib/client" goxmpp "gosrc.io/xmpp" ) -var version string = "1.8.3" +var version string = "1.9.0-dev" var commit string var sm *goxmpp.StreamManager @@ -60,6 +61,9 @@ func main() { log.Fatal(err) } + client.SetLogVerbosityLevel(&client.SetLogVerbosityLevelRequest{ + NewVerbosityLevel: stringToTdlibLogConstant(config.Telegram.Loglevel), + }) SetLogrusLevel(config.XMPP.Loglevel) log.Infof("Starting telegabber version %v", version) @@ -89,6 +93,25 @@ func main() { } } +var tdlibLogConstants = map[string]int32{ + ":fatal": 0, + ":error": 1, + ":warn": 2, + ":info": 3, + ":debug": 4, + ":verbose": 5, + ":all": 1023, +} + +func stringToTdlibLogConstant(c string) int32 { + level, ok := tdlibLogConstants[c] + if !ok { + level = 0 + } + + return level +} + func exit() { xmpp.Close(component) close(cleanupDone) |