Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Wire up the mautrix logger to logrus #369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions clients/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 == "" {
Expand Down