log: new object logging support
So that we can provide the specific object id in every log associated to a given object.
This commit is contained in:
+8
-2
@@ -10,7 +10,8 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2011-2020 Red Hat, Inc.
|
||||
* Copyright (C) 2020 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
@@ -41,6 +42,7 @@
|
||||
#endif
|
||||
|
||||
#include "mm-log.h"
|
||||
#include "mm-log-object.h"
|
||||
|
||||
enum {
|
||||
TS_FLAG_NONE = 0,
|
||||
@@ -200,7 +202,8 @@ log_backend_systemd_journal (const char *loc,
|
||||
#endif
|
||||
|
||||
void
|
||||
_mm_log (const char *loc,
|
||||
_mm_log (gpointer obj,
|
||||
const char *loc,
|
||||
const char *func,
|
||||
MMLogLevel level,
|
||||
const char *fmt,
|
||||
@@ -243,6 +246,9 @@ _mm_log (const char *loc,
|
||||
g_string_append_printf (msgbuf, "[%s] %s(): ", loc, func);
|
||||
#endif
|
||||
|
||||
if (obj)
|
||||
g_string_append_printf (msgbuf, "[%s] ", mm_log_object_get_id (MM_LOG_OBJECT (obj)));
|
||||
|
||||
va_start (args, fmt);
|
||||
g_string_append_vprintf (msgbuf, fmt, args);
|
||||
va_end (args);
|
||||
|
||||
Reference in New Issue
Block a user