Browse Source
Wire up the mautrix logger to logrus
Really makes debugging a lot easier
pull/369/head
Janne Heß
3 years ago
No known key found for this signature in database
GPG Key ID: 69165158F05265DF
1 changed files with
10 additions and
0 deletions
-
clients/clients.go
|
|
@ -55,6 +55,15 @@ func (c *Clients) Update(config api.ClientConfig) (api.ClientConfig, error) { |
|
|
|
return old.config, err |
|
|
|
} |
|
|
|
|
|
|
|
type MautrixLogger struct{} |
|
|
|
|
|
|
|
func (d *MautrixLogger) Debugfln(message string, args ...interface{}) { |
|
|
|
log.Debugf(message, args...) |
|
|
|
} |
|
|
|
func (d *MautrixLogger) Warnfln(message string, args ...interface{}) { |
|
|
|
log.Warnf(message, args...) |
|
|
|
} |
|
|
|
|
|
|
|
// Start listening on client /sync streams
|
|
|
|
func (c *Clients) Start() error { |
|
|
|
configs, err := c.db.LoadMatrixClientConfigs() |
|
|
@ -335,6 +344,7 @@ func (c *Clients) initClient(botClient *BotClient) error { |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
client.Logger = &MautrixLogger{} |
|
|
|
client.Client = c.httpClient |
|
|
|
client.DeviceID = config.DeviceID |
|
|
|
if client.DeviceID == "" { |
|
|
|