new: centralized logging and implemented DELETE /api/events route, closes #5

This commit is contained in:
evilsocket 2018-01-08 06:39:44 +01:00
parent 269d7d845b
commit f1f146d3d7
21 changed files with 144 additions and 184 deletions

View file

@ -70,7 +70,7 @@ func (d *Discovery) Start() error {
d.SetRunning(true)
go func() {
log.Info("Network discovery started.\n")
d.Session.Events.Log(session.INFO, "Network discovery started.")
for {
select {
@ -78,7 +78,7 @@ func (d *Discovery) Start() error {
var err error
if d.current, err = net.ArpUpdate(d.Session.Interface.Name()); err != nil {
log.Error(err)
d.Session.Events.Log(session.ERROR, "%s", err)
continue
}
@ -111,7 +111,7 @@ func (d *Discovery) Start() error {
b = ""
}
log.Warningf("WARNING: Found %d endpoint%s which share%s the same MAC of the gateway (%s), there're might be some IP isolation going on, skipping.\n", n_gw_shared, a, b, d.Session.Gateway.HwAddress)
d.Session.Events.Log(session.WARNING, "WARNING: Found %d endpoint%s which share%s the same MAC of the gateway (%s), there're might be some IP isolation going on, skipping.", n_gw_shared, a, b, d.Session.Gateway.HwAddress)
}
// refresh target pool
@ -127,7 +127,7 @@ func (d *Discovery) Start() error {
d.before = d.current
case <-d.quit:
log.Info("Network discovery stopped.\n")
d.Session.Events.Log(session.INFO, "Network discovery stopped.")
return
}
}