UniLog is a logging platform that can be used to record activities and statuses of your services or customer applications. UniLog supports 4 logging levels: INFO, WARNING, ERROR, CRITICAL.
Besides logging, UniLog also provides a Heartbeat Monitor feature to monitor the uptime of your services and applications. To use the Heartbeat Monitoring feature, you just need to input the URL of the services you want to monitor.
To integrate logging into your application, send requests to the following endpoint:
https://unilog.my.id/api/logger
Make sure to include the X-API-KEY
header with your provided API key.
The JSON payload sent to UniLog must follow this basic structure:
{
"event": "", // Describes the event in the log
"action": "", // HTTP method: POST, GET, PUT, DELETE, PATCH
"level": "", // Log urgency level
"message": "", // Message describing the event
"status_code": , // Status or response code, e.g. if your app sends a request to create a transaction and generate a Virtual Account but fails, send 500 as an integer
"tags": [""] // Log categorization or tags (strings)
}
{
"event": "teacher_login",
"action": "POST",
"level": "INFO",
"message": "John Doe successfully logged in",
"status_code": 200,
"tags": ["auth"]
}
{
"event": "checkout_product",
"action": "POST",
"level": "INFO",
"message": "John Doe checks out products",
"request_data": {
"user_id": 12345,
"cart_id": 98765,
"products": [
{
"product_id": 1001,
"name": "Mechanical Keyboard",
"quantity": 1,
"price": 550000
},
{
"product_id": 1002,
"name": "Wireless Mouse",
"quantity": 2,
"price": 200000
}
],
"total_amount": 950000,
"payment_method": "Bank Transfer"
},
"status_code": 201,
"tags": [
"Checkout",
"E-Commerce",
"User Action"
]
}
{
"event": "checkout_product",
"action": "POST",
"level": "ERROR",
"message": "John Doe failed to checkout: payment gateway did not return order_id and failed to create virtual account.",
"request_data": {
"user_id": 12345,
"cart_id": 98765,
"products": [
{
"product_id": 1001,
"name": "Mechanical Keyboard",
"quantity": 1,
"price": 550000
}
],
"total_amount": 550000,
"payment_method": "Bank Transfer"
},
"response_data": {
"error_code": "PG-001",
"error_message": "Failed to generate order_id",
"gateway_response": {
"status": "error",
"message": "Invalid merchant credentials or system timeout",
"timestamp": "2025-06-01T14:23:10Z"
}
},
"status_code": 500,
"tags": [
"Checkout",
"Payment Gateway Error",
"E-Commerce",
"Failure"
]
}