Logger class
Logger API
The Background Geolocation SDK includes powerful logging features for debugging location-tracking problems. The SDK stores log-entries for a period of Config.logMaxDays (default 3
). The volume of logging events
inserted into the database is controlled via Config.logLevel.
Fetching the Logs:
Logs can be fetched from the SDK in three ways:
Inserting your own log messages
You can even insert your own log messages into the SDK's Log database using the following methods:
method | logLevel | icon |
---|---|---|
error | ERROR |
βοΈ |
warn | WARNING |
β οΈ |
debug | DEBUG |
π |
info | INFO |
βΉοΈ |
notice | INFO |
π΅ |
BackgroundGeolocation.onLocation((Location location) {
Logger.debug("Location received: $location");
});
Example Logs
09-19 11:12:18.716 ββββββββββββββββββββββββββββββββββββββββββββββ
09-19 11:12:18.716 β BackgroundGeolocation Service started
09-19 11:12:18.716 β βββββββββββββββββββββββββββββββββββββββββββββ
09-19 11:12:18.723 [c.t.l.BackgroundGeolocationService d]
09-19 11:12:18.723 β
Started in foreground
09-19 11:12:18.737 [c.t.l.ActivityRecognitionService a]
09-19 11:12:18.737 πΎ Start activity updates: 10000
09-19 11:12:18.761 [c.t.l.BackgroundGeolocationService k]
09-19 11:12:18.761 π΄ Stop heartbeat
09-19 11:12:18.768 [c.t.l.BackgroundGeolocationService a]
09-19 11:12:18.768 πΎ Start heartbeat (60)
09-19 11:12:18.778 [c.t.l.BackgroundGeolocationService a]
09-19 11:12:18.778 π΅ setPace: null β false
09-19 11:12:18.781 [c.t.l.adapter.TSConfig c] βΉοΈ Persist config
09-19 11:12:18.794 [c.t.locationmanager.util.b a]
09-19 11:12:18.794 βΉοΈ LocationAuthorization: Permission granted
09-19 11:12:18.842 [c.t.l.http.HttpService flush]
09-19 11:12:18.842 ββββββββββββββββββββββββββββββββββββββββββββββ
09-19 11:12:18.842 β HTTP Service
09-19 11:12:18.842 β βββββββββββββββββββββββββββββββββββββββββββββ
09-19 11:12:19.000 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
09-19 11:12:21.314 [c.t.l.l.SingleLocationRequest$2 onLocationResult]
09-19 11:12:21.314 ββββββββββββββββββββββββββββββββββββββββββββββ
09-19 11:12:21.314 β SingleLocationRequest: 1
09-19 11:12:21.314 β βββββββββββββββββββββββββββββββββββββββββββββ
09-19 11:12:21.314 ββ π Location[fused 45.519239,-73.617058 hAcc=15]999923706055 vAcc=2 sAcc=??? bAcc=???
09-19 11:12:21.327 [c.t.l.l.TSLocationManager onSingleLocationResult]
09-19 11:12:21.327 π΅ Acquired motionchange position, isMoving: false
09-19 11:12:21.342 [c.t.l.l.TSLocationManager a] 15.243
09-19 11:12:21.405 [c.t.locationmanager.data.a.c persist]
09-19 11:12:21.405 β
INSERT: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
09-19 11:12:21.423 [c.t.l.http.HttpService flush]
09-19 11:12:21.423 ββββββββββββββββββββββββββββββββββββββββββββββ
09-19 11:12:21.423 β HTTP Service
09-19 11:12:21.423 β βββββββββββββββββββββββββββββββββββββββββββββ
09-19 11:12:21.446 [c.t.locationmanager.data.a.c first]
09-19 11:12:21.446 β
Locked 1 records
09-19 11:12:21.454 [c.t.l.http.HttpService a]
09-19 11:12:21.454 π΅ HTTP POST: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
09-19 11:12:22.083 [c.t.l.http.HttpService$a onResponse]
09-19 11:12:22.083 π΅ Response: 200
09-19 11:12:22.100 [c.t.locationmanager.data.a.c destroy]
09-19 11:12:22.100 β
DESTROY: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
09-19 11:12:55.226 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
Constructors
Properties
- hashCode β int
-
The hash code for this object.
no setterinherited
- runtimeType β Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) β dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) β String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) β bool -
The equality operator.
inherited
Static Methods
-
debug(
String msg) β Future< void> - Inserts a debug log message into the SDK's log database
-
destroyLog(
) β Future< bool> - Destroy the entire contents of plugin's log database.
-
emailLog(
String email, [SQLQuery? query]) β Future< bool> - Email the result of getLog using device's mail client. Provide an optional SQLQuery to contrain results between dates.
-
error(
String msg) β Future< void> - Inserts an "error" log message into the SDK's log database
-
getLog(
[SQLQuery? query]) β Future< String> -
Returns the contents of the log database as a
String
. Provide an optional SQLQuery to contrain results between dates. -
info(
String msg) β Future< void> - Inserts an "info" log message into the SDK's log database
-
notice(
String msg) β Future< void> - Inserts a "notice" log message into the SDK's log database
-
uploadLog(
String url, [SQLQuery? query]) β Future< bool> - Upload the result of getLog to provided url. Provide an optional SQLQuery to contrain results between dates. The file-upload request will attach your configured Config.headers for authentication.
-
warn(
String msg) β Future< void> - Inserts a "warning" log message into the SDK's log database