}
static int pakfire_job_send_log_line(struct pakfire_job* job,
- int priority, const char* line, size_t length) {
+ const struct timeval* timestamp, int priority, const char* line, size_t length) {
struct json_object* message = NULL;
struct json_object* data = NULL;
+ char buffer[64];
int r;
// Create a new JSON object
goto ERROR;
}
+ // Format timestamp
+ r = pakfire_timeval_to_iso8601(buffer, timestamp);
+ if (r < 0)
+ goto ERROR;
+
+ // Add the timestamp
+ r = pakfire_json_add_string(data, "timestamp", buffer);
+ if (r < 0)
+ goto ERROR;
+
// Add the priority
r = pakfire_json_add_uint64(data, "priority", priority);
if (r)
break;
// If we have received a line let's send it
- r = pakfire_job_send_log_line(job, priority, line, length);
+ r = pakfire_job_send_log_line(job, ×tamp, priority, line, length);
free(line);
if (r < 0)
return r;