mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 13:09:49 -07:00
fix: fixed logging system
This commit is contained in:
parent
e7687c658f
commit
9fc31b0b2c
2 changed files with 8 additions and 12 deletions
|
@ -101,11 +101,7 @@ func (p *EventPool) Add(tag string, data interface{}) {
|
||||||
e := NewEvent(tag, data)
|
e := NewEvent(tag, data)
|
||||||
p.events = append([]Event{e}, p.events...)
|
p.events = append([]Event{e}, p.events...)
|
||||||
|
|
||||||
select {
|
go func() { p.NewEvents <- e }()
|
||||||
case p.NewEvents <- e:
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *EventPool) Log(level int, format string, args ...interface{}) {
|
func (p *EventPool) Log(level int, format string, args ...interface{}) {
|
||||||
|
|
|
@ -47,27 +47,27 @@ var (
|
||||||
|
|
||||||
func (c *SnifferContext) Log(sess *session.Session) {
|
func (c *SnifferContext) Log(sess *session.Session) {
|
||||||
if c.DumpLocal {
|
if c.DumpLocal {
|
||||||
sess.Events.Log(session.INFO, "Skip local packets : "+no)
|
sess.Events.Log(session.INFO, "Skip local packets : %s", no)
|
||||||
} else {
|
} else {
|
||||||
sess.Events.Log(session.INFO, "Skip local packets : "+yes)
|
sess.Events.Log(session.INFO, "Skip local packets : %s", yes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Verbose {
|
if c.Verbose {
|
||||||
sess.Events.Log(session.INFO, "Verbose : "+yes)
|
sess.Events.Log(session.INFO, "Verbose : %s", yes)
|
||||||
} else {
|
} else {
|
||||||
sess.Events.Log(session.INFO, "Verbose : "+no)
|
sess.Events.Log(session.INFO, "Verbose : %s", no)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Filter != "" {
|
if c.Filter != "" {
|
||||||
sess.Events.Log(session.INFO, "BPF Filter : '"+core.Yellow(c.Filter)+"'")
|
sess.Events.Log(session.INFO, "BPF Filter : '%s'", core.Yellow(c.Filter))
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Expression != "" {
|
if c.Expression != "" {
|
||||||
sess.Events.Log(session.INFO, "Regular expression : '"+core.Yellow(c.Expression)+"'")
|
sess.Events.Log(session.INFO, "Regular expression : '%s'", core.Yellow(c.Expression))
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Output != "" {
|
if c.Output != "" {
|
||||||
sess.Events.Log(session.INFO, "File output : '"+core.Yellow(c.Output)+"'")
|
sess.Events.Log(session.INFO, "File output : '%s'", core.Yellow(c.Output))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue