summaryrefslogtreecommitdiffstats
path: root/lib/agent/events.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-10-11 00:24:02 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-10-11 00:24:02 +0200
commit4695555e178bcabe54c5bf82117c9c4cef5440b5 (patch)
tree96a8721de74347450b2e4922004b1bf01e415dfa /lib/agent/events.go
parent882944a748d123c8715eca88536299d8570858f9 (diff)
Fixed Syncthing folder status events and exec command.
Diffstat (limited to 'lib/agent/events.go')
-rw-r--r--lib/agent/events.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/agent/events.go b/lib/agent/events.go
index 24efc5a..e66f758 100644
--- a/lib/agent/events.go
+++ b/lib/agent/events.go
@@ -18,7 +18,7 @@ const (
EVTProjectChange = "project-state-change" // data type ProjectConfig
)
-var EVTAllList = []string{
+var _EVTAllList = []string{
EVTServerConfig,
EVTProjectAdd,
EVTProjectDelete,
@@ -33,7 +33,6 @@ type EventMsg struct {
}
type EventDef struct {
- // SEB cbs []EventsCB
sids map[string]int
}
@@ -45,7 +44,7 @@ type Events struct {
// NewEvents creates an instance of Events
func NewEvents(ctx *Context) *Events {
evMap := make(map[string]*EventDef)
- for _, ev := range EVTAllList {
+ for _, ev := range _EVTAllList {
evMap[ev] = &EventDef{
sids: make(map[string]int),
}
@@ -58,12 +57,12 @@ func NewEvents(ctx *Context) *Events {
// GetList returns the list of all supported events
func (e *Events) GetList() []string {
- return EVTAllList
+ return _EVTAllList
}
// Register Used by a client/session to register to a specific (or all) event(s)
func (e *Events) Register(evName, sessionID string) error {
- evs := EVTAllList
+ evs := _EVTAllList
if evName != EVTAll {
if _, ok := e.eventsMap[evName]; !ok {
return fmt.Errorf("Unsupported event type name")
@@ -78,7 +77,7 @@ func (e *Events) Register(evName, sessionID string) error {
// UnRegister Used by a client/session to unregister event(s)
func (e *Events) UnRegister(evName, sessionID string) error {
- evs := EVTAllList
+ evs := _EVTAllList
if evName != EVTAll {
if _, ok := e.eventsMap[evName]; !ok {
return fmt.Errorf("Unsupported event type name")
@@ -102,7 +101,9 @@ func (e *Events) Emit(evName string, data interface{}) error {
return fmt.Errorf("Unsupported event type")
}
- e.Log.Debugf("Emit Event %s: %v", evName, data)
+ if e.LogLevelSilly {
+ e.Log.Debugf("Emit Event %s: %v", evName, data)
+ }
firstErr = nil
evm := e.eventsMap[evName]