mirror of
https://github.com/bettercap/bettercap
synced 2025-07-14 00:53:46 -07:00
refact: centralized logging into log package using Session singleton instance
This commit is contained in:
parent
23ee1223a2
commit
e36bcacf00
11 changed files with 117 additions and 72 deletions
|
@ -17,6 +17,10 @@ import (
|
|||
"github.com/evilsocket/bettercap-ng/packets"
|
||||
)
|
||||
|
||||
var (
|
||||
I = (*Session)(nil)
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
Options core.Options `json:"options"`
|
||||
Interface *net.Endpoint `json:"interface"`
|
||||
|
@ -65,6 +69,10 @@ func New() (*Session, error) {
|
|||
|
||||
s.registerCoreHandlers()
|
||||
|
||||
if I == nil {
|
||||
I = s
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
|
@ -217,7 +225,7 @@ func (s *Session) ReadLine() (string, error) {
|
|||
}
|
||||
|
||||
func (s *Session) RunCaplet(filename string) error {
|
||||
s.Events.Log(INFO, "Reading from caplet %s ...\n", filename)
|
||||
s.Events.Log(INFO, "Reading from caplet %s ...", filename)
|
||||
|
||||
input, err := os.Open(filename)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue