1
0
Fork 0
mirror of https://github.com/Luzifer/automail.git synced 2024-12-20 13:01:20 +00:00

Add debugging for script commands

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-06-27 16:01:58 +02:00
parent ccc77f980e
commit e2b309056f
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -49,6 +49,7 @@ func (m mailHandler) Process(imapClient *client.Client, msg *imap.Message, envel
scanner := bufio.NewScanner(stdout)
for scanner.Scan() {
if scanner.Err() != nil {
log.WithError(err).Error("Stdout errored")
return
}
@ -58,6 +59,11 @@ func (m mailHandler) Process(imapClient *client.Client, msg *imap.Message, envel
continue
}
log.WithFields(log.Fields{
"type": cw.Type,
"uid": msg.Uid,
}).Debug("Received command from script")
c, err := cw.rewrap(scanner.Bytes())
if err != nil {
log.WithError(err).Error("Unable to parse command")