Add timestamps if logging to a file

And try to match appearance of console messages.
This commit is contained in:
Paweł Forysiuk 2011-05-29 17:13:08 +02:00 committed by Christian Dywan
parent fc842d9751
commit 15a65b6166

View file

@ -1876,6 +1876,7 @@ midori_log_to_file (const gchar* log_domain,
{ {
FILE* logfile = fopen ((const char*)user_data, "a"); FILE* logfile = fopen ((const char*)user_data, "a");
gchar* level_name = ""; gchar* level_name = "";
time_t timestamp = time (NULL);
switch (log_level) switch (log_level)
{ {
@ -1904,7 +1905,7 @@ midori_log_to_file (const gchar* log_domain,
break; break;
} }
fprintf (logfile, "%s %s: %s\n", fprintf (logfile, "%s%s-%s **: %s\n", asctime (localtime (&timestamp)),
log_domain ? log_domain : "Midori", level_name, message); log_domain ? log_domain : "Midori", level_name, message);
fclose (logfile); fclose (logfile);
} }