Move zerolog.CallerMarshalFunc to mautrix-go

This commit is contained in:
Tulir Asokan
2023-05-06 20:18:13 +03:00
parent 35f534affa
commit 6738a04715
3 changed files with 3 additions and 18 deletions

15
main.go
View File

@@ -18,13 +18,8 @@ package main
import (
_ "embed"
"fmt"
"runtime"
"strings"
"sync"
"github.com/rs/zerolog"
"maunium.net/go/mautrix/bridge"
"maunium.net/go/mautrix/bridge/commands"
"maunium.net/go/mautrix/id"
@@ -101,16 +96,6 @@ func (br *DiscordBridge) Init() {
br.DB = database.New(br.Bridge.DB, br.Log.Sub("Database"))
discordLog = br.ZLog.With().Str("component", "discordgo").Logger()
// TODO move this to mautrix-go?
zerolog.CallerMarshalFunc = func(pc uintptr, file string, line int) string {
files := strings.Split(file, "/")
file = files[len(files)-1]
name := runtime.FuncForPC(pc).Name()
fns := strings.Split(name, ".")
name = fns[len(fns)-1]
return fmt.Sprintf("%s:%d:%s()", file, line, name)
}
}
func (br *DiscordBridge) Start() {