mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-11-15 22:42:35 +01:00
Don't open log file if file name format is unset
This commit is contained in:
parent
80a0edd855
commit
18724cde6e
1 changed files with 8 additions and 6 deletions
8
main.go
8
main.go
|
@ -112,20 +112,22 @@ func (bridge *Bridge) Init() {
|
|||
|
||||
bridge.AS, err = bridge.Config.MakeAppService()
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Failed to initialize AppService:", err)
|
||||
_, _ = fmt.Fprintln(os.Stderr, "Failed to initialize AppService:", err)
|
||||
os.Exit(11)
|
||||
}
|
||||
bridge.AS.Init()
|
||||
_, _ = bridge.AS.Init()
|
||||
bridge.Bot = bridge.AS.BotIntent()
|
||||
|
||||
bridge.Log = log.Create()
|
||||
bridge.Config.Logging.Configure(bridge.Log)
|
||||
log.DefaultLogger = bridge.Log.(*log.BasicLogger)
|
||||
if len(bridge.Config.Logging.FileNameFormat) > 0 {
|
||||
err = log.OpenFile()
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Failed to open log file:", err)
|
||||
_, _ = fmt.Fprintln(os.Stderr, "Failed to open log file:", err)
|
||||
os.Exit(12)
|
||||
}
|
||||
}
|
||||
bridge.AS.Log = log.Sub("Matrix")
|
||||
|
||||
bridge.Log.Debugln("Initializing state store")
|
||||
|
|
Loading…
Reference in a new issue