pgterminate/notifier/console.go

32 lines
603 B
Go
Raw Normal View History

2018-06-10 08:44:53 +02:00
package notifier
import (
"github.com/jouir/pgterminate/base"
2018-06-24 17:49:48 +02:00
"github.com/jouir/pgterminate/log"
2018-06-10 08:44:53 +02:00
)
// Console notifier structure
type Console struct {
sessions chan base.Session
}
// NewConsole creates a console notifier
func NewConsole(sessions chan base.Session) Notifier {
return &Console{
sessions: sessions,
}
}
// Run starts console notifier
func (c *Console) Run() {
2018-06-24 17:49:48 +02:00
log.Info("Starting console notifier")
2018-06-10 08:44:53 +02:00
for session := range c.sessions {
2018-06-24 17:49:48 +02:00
log.Infof("%s\n", session)
2018-06-10 08:44:53 +02:00
}
}
// Reload for handling SIGHUP signals
func (c *Console) Reload() {
2018-06-24 17:49:48 +02:00
log.Info("Reloading console notifier")
2018-06-10 08:44:53 +02:00
}