Initial pgterminate code
This commit is contained in:
parent
0487d635fc
commit
565c45a8fc
15 changed files with 697 additions and 0 deletions
20
notifier/notifier.go
Normal file
20
notifier/notifier.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package notifier
|
||||
|
||||
import (
|
||||
"github.com/jouir/pgterminate/base"
|
||||
)
|
||||
|
||||
// Notifier generic interface for implementing a notifier
|
||||
type Notifier interface {
|
||||
Run()
|
||||
Reload()
|
||||
}
|
||||
|
||||
// NewNotifier looks into Config to create a File or Console notifier and pass it
|
||||
// the session channel for consuming sessions structs sent by terminator
|
||||
func NewNotifier(ctx *base.Context) Notifier {
|
||||
if ctx.Config.LogFile != "" {
|
||||
return NewFile(ctx.Config.LogFile, ctx.Sessions)
|
||||
}
|
||||
return NewConsole(ctx.Sessions)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue