-1
. Used to order results of SQLQuery ascending.
1
. Used to order results of SQLQuery descending.
Inserts a debug log message into the SDK's log database
Destroy the entire contents of SDK's log database.
Inserts an "error" log message into the SDK's log database
Inserts an "info" log message into the SDK's log database
Inserts a "notice" log message into the SDK's log database
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.
BackgroundGeolocation.logger.uploadLog("https://my.server.com/users/123/logs").then((success) => {
console.log("[uploadLog] success");
}).catch((error) => {
console.log("[uploadLog] FAILURE:", error);
});
// Or constrain results by providing a [SQLQuery]:
BackgroundGeolocation.logger.uploadLog("https://my.server.com/users/123/logs", {
start: Date.parse("2019-10-20 09:00"),
end: Date.parse("2019-10-20 11:59")
}).then((success) => {
console.log("[uploadLog] success");
}).catch((error) => {
console.log("[uploadLog] FAILURE:", error);
});
The SDK will upload the gzipped log-file to your server as a Multi-part file upload, the same log-file as used in emailLog. This is what I see with my Node server at request.files
:
app.post("/log", async function(req, res) {
console.log("[body]: ", req.body);
console.log("[files]: ", req.files);
res.status(200).send();
});
In addition to the log-file, the SDK will upload a form as well, containing the following parameters:
Key | Value |
---|---|
state |
JSON-encoded result of SDK's #getState |
model |
Device model |
manufacturer |
Device manufacturer |
platform |
iOS or Android |
version |
OS version |
Inserts a "warning" log message into the SDK's log database
Generated using TypeDoc
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.For more information, see the đDebugging Guide.
The
Logger
API is accessed via BackgroundGeolocation.logger property: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:
ERROR
WARNING
DEBUG
INFO
INFO
Example Logs