pgterminate/notifier/console.go

32 lines
605 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 {
2018-07-08 23:48:48 +02:00
sessions chan *base.Session
2018-06-10 08:44:53 +02:00
}
// NewConsole creates a console notifier
2018-07-08 23:48:48 +02:00
func NewConsole(sessions chan *base.Session) Notifier {
2018-06-10 08:44:53 +02:00
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
}