forked from home-assistant/os-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable sentry reporting on Panic (home-assistant#18)
* Enable sentry reporting on Panic
- Loading branch information
Showing
2 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,10 @@ const ( | |
sentryDsn = "https://[email protected]/5710878" | ||
) | ||
|
||
var version string = "dev" | ||
var ( | ||
version string = "dev" | ||
enableCapture bool = true | ||
) | ||
|
||
func main() { | ||
logging.Info.Printf("Start OS-Agent %s", version) | ||
|
@@ -38,6 +41,7 @@ func main() { | |
} | ||
|
||
defer sentry.Flush(2 * time.Second) | ||
defer sentry.Recover() | ||
|
||
// Connect DBus | ||
conn, err := dbus.SystemBus() | ||
|
@@ -79,6 +83,16 @@ func InitializeDBus(conn *dbus.Conn) { | |
Emit: prop.EmitInvalidates, | ||
Callback: nil, | ||
}, | ||
"Telemetry": { | ||
Value: enableCapture, | ||
Writable: true, | ||
Emit: prop.EmitTrue, | ||
Callback: func(c *prop.Change) *dbus.Error { | ||
logging.Info.Printf("Telemetry is now %t", c.Value) | ||
enableCapture = c.Value.(bool) | ||
return nil | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters