Add log-format option
This commit is contained in:
parent
fac5099c9b
commit
24eb4fe203
9 changed files with 61 additions and 44 deletions
|
|
@ -7,12 +7,14 @@ import (
|
|||
|
||||
// Console notifier structure
|
||||
type Console struct {
|
||||
format string
|
||||
sessions chan *base.Session
|
||||
}
|
||||
|
||||
// NewConsole creates a console notifier
|
||||
func NewConsole(sessions chan *base.Session) Notifier {
|
||||
func NewConsole(format string, sessions chan *base.Session) Notifier {
|
||||
return &Console{
|
||||
format: format,
|
||||
sessions: sessions,
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +23,7 @@ func NewConsole(sessions chan *base.Session) Notifier {
|
|||
func (c *Console) Run() {
|
||||
log.Info("Starting console notifier")
|
||||
for session := range c.sessions {
|
||||
log.Infof("%s\n", session)
|
||||
log.Info(session.Format(c.format))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue