From fcc771f3e3363c81eda3e313991ef14aeb250014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Mon, 3 Jan 2022 19:06:58 +0100 Subject: [PATCH] Wire up the mautrix logger to logrus Really makes debugging a lot easier --- clients/clients.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clients/clients.go b/clients/clients.go index 0e5816c..1be29ad 100644 --- a/clients/clients.go +++ b/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 == "" {