-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdbus.go
More file actions
36 lines (29 loc) · 816 Bytes
/
dbus.go
File metadata and controls
36 lines (29 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
// "fmt"
"github.com/godbus/dbus"
)
type dbusObject struct {
dbus.BusObject
}
type slmData struct {
EventID string
LogLevel string
Timestamp int64
LogLine string
OrigLogLine string
Metadata map[string]string
}
func newDbusObject() (*dbusObject, error) {
conn, err := dbus.SystemBus()
if err != nil {
return nil, err
}
return &dbusObject{conn.Object("com.subgraph.EventNotifier", "/com/subgraph/EventNotifier")}, nil
}
func (ob *dbusObject) alertObj(id, level string, timestamp int64, line, oline string, metadata map[string]string) {
// fmt.Println("id = ", id)
// fmt.Println("xyz: ", line)
dobj := slmData{id, level, timestamp, line, oline, metadata}
ob.Call("com.subgraph.EventNotifier.Alert", 0, dobj)
}