log: Remove g_get_current_time
This commit is contained in:
+8
-10
@@ -56,25 +56,23 @@ gcal_log_handler (const gchar *domain,
|
|||||||
const gchar *message,
|
const gchar *message,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GTimeVal tv;
|
g_autoptr (GDateTime) now = NULL;
|
||||||
g_autofree gchar *buffer = NULL;
|
g_autofree gchar *buffer = NULL;
|
||||||
struct tm tt;
|
g_autofree gchar *ftime = NULL;
|
||||||
time_t t;
|
|
||||||
const gchar *level;
|
const gchar *level;
|
||||||
gchar ftime[32];
|
gint microsecond;
|
||||||
|
|
||||||
/* Skip ignored log domains */
|
/* Skip ignored log domains */
|
||||||
if (domain && g_strv_contains (ignored_domains, domain))
|
if (domain && g_strv_contains (ignored_domains, domain))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
level = log_level_str (log_level);
|
level = log_level_str (log_level);
|
||||||
g_get_current_time (&tv);
|
now = g_date_time_new_now_local ();
|
||||||
t = (time_t) tv.tv_sec;
|
ftime = g_date_time_format (now, "%H:%M:%S");
|
||||||
tt = *localtime (&t);
|
microsecond = g_date_time_get_microsecond (now);
|
||||||
strftime (ftime, sizeof (ftime), "%H:%M:%S", &tt);
|
buffer = g_strdup_printf ("%s.%04d %28s: %s: %s\n",
|
||||||
buffer = g_strdup_printf ("%s.%04ld %28s: %s: %s\n",
|
|
||||||
ftime,
|
ftime,
|
||||||
tv.tv_usec / 1000,
|
microsecond,
|
||||||
domain,
|
domain,
|
||||||
level,
|
level,
|
||||||
message);
|
message);
|
||||||
|
|||||||
Reference in New Issue
Block a user