logmania/notify/xmpp/internal.go

22 lines
484 B
Go
Raw Normal View History

2017-06-16 10:33:35 +02:00
package xmpp
import (
"fmt"
"github.com/genofire/logmania/log"
)
2017-06-16 10:33:35 +02:00
2017-08-09 08:45:45 +02:00
func formatEntry(e *log.Entry) string {
2017-08-30 09:10:56 +02:00
if e.Hostname != "" && e.Service != "" {
return fmt.Sprintf("[%s-%s] [%s] %s", e.Hostname, e.Service, e.Level, e.Text)
} else if e.Hostname != "" {
return fmt.Sprintf("[%s] [%s] %s", e.Hostname, e.Level, e.Text)
} else if e.Service != "" {
return fmt.Sprintf("[%s] [%s] %s", e.Service, e.Level, e.Text)
}
return fmt.Sprintf("[%s] %s", e.Level, e.Text)
2017-06-16 10:33:35 +02:00
}