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
14
main.go
14
main.go
|
@ -112,19 +112,21 @@ func (bridge *Bridge) Init() {
|
||||||
|
|
||||||
bridge.AS, err = bridge.Config.MakeAppService()
|
bridge.AS, err = bridge.Config.MakeAppService()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Failed to initialize AppService:", err)
|
_, _ = fmt.Fprintln(os.Stderr, "Failed to initialize AppService:", err)
|
||||||
os.Exit(11)
|
os.Exit(11)
|
||||||
}
|
}
|
||||||
bridge.AS.Init()
|
_, _ = bridge.AS.Init()
|
||||||
bridge.Bot = bridge.AS.BotIntent()
|
bridge.Bot = bridge.AS.BotIntent()
|
||||||
|
|
||||||
bridge.Log = log.Create()
|
bridge.Log = log.Create()
|
||||||
bridge.Config.Logging.Configure(bridge.Log)
|
bridge.Config.Logging.Configure(bridge.Log)
|
||||||
log.DefaultLogger = bridge.Log.(*log.BasicLogger)
|
log.DefaultLogger = bridge.Log.(*log.BasicLogger)
|
||||||
err = log.OpenFile()
|
if len(bridge.Config.Logging.FileNameFormat) > 0 {
|
||||||
if err != nil {
|
err = log.OpenFile()
|
||||||
fmt.Fprintln(os.Stderr, "Failed to open log file:", err)
|
if err != nil {
|
||||||
os.Exit(12)
|
_, _ = fmt.Fprintln(os.Stderr, "Failed to open log file:", err)
|
||||||
|
os.Exit(12)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bridge.AS.Log = log.Sub("Matrix")
|
bridge.AS.Log = log.Sub("Matrix")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue