Request: on Linux, option to use system uptime instead of program uptime
cxw42 opened this issue · comments
In my use case at $work
, I need to correlate loguru logs from a userspace program with dmesg output. Unfortunately, this is an old enough system that it does not support dmesg -T
:(. Therefore, it would be very helpful for the loguru "uptime" field to have an option to use the system uptime. That can be had using clock_gettime()
:
#include <stdio.h>
#include <time.h>
int main()
{
struct timespec ts;
clock_gettime(CLOCK_BOOTTIME, &ts);
printf("%f\n", ts.tv_sec + (double)ts.tv_nsec/1e9);
return 0;
}
Would you be willing to add this as a compile-time or run-time option? Thank you for considering this request!
Loguru is in passive maintenance mode. If you make a PR for it with some docs and everything is green, I will merge it! Make sure it compiles on all platforms (it's fine if the flag only exists on some platforms).