diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-11-08 17:45:39 +0100 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-11-08 17:45:39 +0100 |
commit | 1f754944c23df02b64aeb591d502b36ad314c5eb (patch) | |
tree | c6d624474a6bce0a63e1460d2acb83978caf715e /cmd-exec.go | |
parent | b6049d0b616812bc72d0549d88cc59f21d517b7c (diff) |
Log projects events.
Diffstat (limited to 'cmd-exec.go')
-rw-r--r-- | cmd-exec.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd-exec.go b/cmd-exec.go index 1d121c3..c02496b 100644 --- a/cmd-exec.go +++ b/cmd-exec.go @@ -61,6 +61,7 @@ func exec(ctx *cli.Context) error { exitChan := make(chan exitResult, 1) IOsk.On("disconnection", func(err error) { + Log.Debugf("WS disconnection event with err: %v\n", err) exitChan <- exitResult{err, 2} }) @@ -85,6 +86,15 @@ func exec(ctx *cli.Context) error { exitChan <- exitResult{ev.Error, ev.Code} }) + IOsk.On(apiv1.EVTProjectChange, func(ev apiv1.EventMsg) { + prj, _ := ev.DecodeProjectConfig() + Log.Infof("Event %v (%v): %v", ev.Type, ev.Time, prj) + }) + evReg := apiv1.EventRegisterArgs{Name: apiv1.EVTProjectChange} + if err := HTTPCli.Post("/events/register", &evReg, nil); err != nil { + return cli.NewExitError(err, 1) + } + // Retrieve the project definition prj := apiv1.ProjectConfig{} if err := HTTPCli.Get("/projects/"+prjID, &prj); err != nil { |