For now, libraries are created only for PHP and JavaScript, but sending records from other languages shouldn't be difficult
Project token and URL
If you have not done so already, you will need to create a new Project. You can do it on Projects page in Logstats application (more).
Then you need to get project token from Projects page in Logstats application. This token will be
used to associate logger with given project.
Furthermore you need URL to which you will send data. It consists of URL to which you have uploaded
Logstats application and suffix "/api". For example: "http://your-domain.com/logstats/api"
Sending records
Data should be send as POST HTTP request on given URL in this format
project : projectToken
messages : allRecords (described later)
allRecords should be array of records encoded as JSON. Every record has to be in this format
message: some_message
level: some_level
time: current_unix_timestamp_in_seconds
context: some_context
level has to be one of the following: debug, info, notice, warning, error, alert, critical, emergency
time is integer, current unix timestamp in seconds
Context is optional and can contain data associated with event. For example, for purchase it can be user, which made the purchase, purchased product, or price. For data in context, Logstats application enables filtering and charts visualization.
PHP example
For example, for PHP, POST data would look like this:
[
'project' => 'my_project_token',
'messages' => json_encode([
[
'message' => 'Could not connect to database',
'level' => 'alert',
'time' => 1454014562
],
[
'message' => 'purchase',
'level' => 'info',
'time' => 1454014572
'context' => [
'user' => [
'name' => 'Marek',
'age' => 20
],
'price' => 55.3
]
],
])
]