Add timestamping to console debug.
This commit is contained in:
parent
8ebf5b4254
commit
31669d2d6d
1 changed files with 8 additions and 5 deletions
13
src/main.c
13
src/main.c
|
@ -498,16 +498,19 @@ tvhlogv(int notify, int severity, const char *subsys, const char *fmt,
|
|||
if(log_debug_to_syslog || severity < LOG_DEBUG)
|
||||
syslog(severity, "%s", buf);
|
||||
|
||||
/**
|
||||
* Get time (string)
|
||||
*/
|
||||
time(&now);
|
||||
localtime_r(&now, &tm);
|
||||
strftime(t, sizeof(t), "%b %d %H:%M:%S", &tm);
|
||||
|
||||
/**
|
||||
* Send notification to Comet (Push interface to web-clients)
|
||||
*/
|
||||
if(notify) {
|
||||
htsmsg_t *m;
|
||||
|
||||
time(&now);
|
||||
localtime_r(&now, &tm);
|
||||
strftime(t, sizeof(t), "%b %d %H:%M:%S", &tm);
|
||||
|
||||
snprintf(buf2, sizeof(buf2), "%s %s", t, buf);
|
||||
m = htsmsg_create_map();
|
||||
htsmsg_add_str(m, "notificationClass", "logmessage");
|
||||
|
@ -531,7 +534,7 @@ tvhlogv(int notify, int severity, const char *subsys, const char *fmt,
|
|||
} else {
|
||||
sgroff = "\033[0m";
|
||||
}
|
||||
fprintf(stderr, "%s[%s]:%s%s\n", sgr, leveltxt, buf, sgroff);
|
||||
fprintf(stderr, "%s%s [%s]:%s%s\n", sgr, t, leveltxt, buf, sgroff);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue