treewide: ban global zerolog
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.6.0
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
exclude_types: [markdown]
|
||||
@@ -21,8 +21,9 @@ repos:
|
||||
- id: go-mod-tidy
|
||||
|
||||
- repo: https://github.com/beeper/pre-commit-go
|
||||
rev: v0.3.1
|
||||
rev: v0.4.0
|
||||
hooks:
|
||||
- id: prevent-literal-http-methods
|
||||
- id: zerolog-ban-global-log
|
||||
- id: zerolog-ban-msgf
|
||||
- id: zerolog-use-stringer
|
||||
- id: prevent-literal-http-methods
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/gotd/td/tg"
|
||||
"github.com/gotd/td/tgerr"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"maunium.net/go/mautrix/bridgev2"
|
||||
"maunium.net/go/mautrix/bridgev2/database"
|
||||
"maunium.net/go/mautrix/bridgev2/networkid"
|
||||
@@ -24,6 +23,7 @@ func (t *TelegramClient) getTakeoutID(ctx context.Context) (takeoutID int64, err
|
||||
if t.stopTakeoutTimer != nil {
|
||||
t.stopTakeoutTimer.Stop()
|
||||
}
|
||||
log := zerolog.Ctx(ctx).With().Str("function", "getTakeoutID").Logger()
|
||||
|
||||
if t.userLogin.Metadata.(*UserLoginMetadata).TakeoutID != 0 {
|
||||
// Resume fetching dialogs using takeout and enqueueing them for
|
||||
@@ -38,7 +38,6 @@ func (t *TelegramClient) getTakeoutID(ctx context.Context) (takeoutID int64, err
|
||||
|
||||
t.stopTakeoutTimer = time.AfterFunc(max(time.Hour, time.Duration(t.main.Bridge.Config.Backfill.Queue.BatchDelay*2)), sync.OnceFunc(func() { t.stopTakeout(ctx) }))
|
||||
|
||||
log := zerolog.Ctx(ctx).With().Str("function", "getTakeoutID").Logger()
|
||||
for {
|
||||
t.takeoutAccepted.Clear()
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
"github.com/gotd/td/telegram/updates"
|
||||
"github.com/gotd/td/tg"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"go.mau.fi/util/exsync"
|
||||
"go.mau.fi/zerozap"
|
||||
"go.uber.org/zap"
|
||||
@@ -429,7 +428,7 @@ func (t *TelegramClient) onAuthError(err error) {
|
||||
})
|
||||
t.userLogin.Metadata.(*UserLoginMetadata).Session.AuthKey = nil
|
||||
if err := t.userLogin.Save(context.Background()); err != nil {
|
||||
log.Err(err).Msg("failed to save user login")
|
||||
t.main.Bridge.Log.Err(err).Msg("failed to save user login")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user