summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2006-10-21 20:23:56 +0000
committerAkira TAGOH <akira@tagoh.org>2006-10-21 20:23:56 +0000
commit01dab26bc877a730a7ab8a4bbc7f328a2260367a (patch)
tree26c4a6adc34927a8d1be2f4055c6cc5a5e12fca7
parentf6dfc9c6c80ba6b65e18edc858b37c9a670e2dde (diff)
* add the log domain.
-rw-r--r--devices/cairo/Makefile.am6
-rw-r--r--devices/x11-embedded/Makefile.am2
-rw-r--r--hieroglyph/Makefile.am2
-rw-r--r--hieroglyph/hglog.c28
-rw-r--r--hieroglyph/hglog.h21
-rw-r--r--hieroglyph/version.h.in2
-rw-r--r--plugins/debug/Makefile.am2
-rw-r--r--plugins/libedit/Makefile.am2
-rw-r--r--plugins/test/Makefile.am2
9 files changed, 48 insertions, 19 deletions
diff --git a/devices/cairo/Makefile.am b/devices/cairo/Makefile.am
index b4f68df..a662063 100644
--- a/devices/cairo/Makefile.am
+++ b/devices/cairo/Makefile.am
@@ -22,6 +22,10 @@ libhieroglyph_cairo_la_SOURCES = \
hgdevice-cairo.c \
hgdevice-cairo.h \
$(NULL)
+libhieroglyph_cairo_la_CFLAGS = \
+ -DHG_LOG_DOMAIN="\"Hieroglyph-Cairo\"" \
+ $(CFLAGS) \
+ $(NULL)
libhieroglyph_cairo_la_LIBADD = \
$(LDADDS) \
$(NULL)
@@ -35,7 +39,7 @@ libx11_device_la_SOURCES = \
cairo-xlib-main.c \
$(NULL)
libx11_device_la_CFLAGS = \
- -DG_LOG_DOMAIN="\"X11-Device\"" \
+ -DHG_LOG_DOMAIN="\"X11-Device\"" \
$(CFLAGS) \
$(NULL)
libx11_device_la_LDFLAGS = \
diff --git a/devices/x11-embedded/Makefile.am b/devices/x11-embedded/Makefile.am
index 6dd53ab..c1af426 100644
--- a/devices/x11-embedded/Makefile.am
+++ b/devices/x11-embedded/Makefile.am
@@ -33,7 +33,7 @@ libx11_embedded_device_la_SOURCES = \
x11-embedded-main.c \
$(NULL)
libx11_embedded_device_la_CFLAGS = \
- -DG_LOG_DOMAIN="\"X11-Embedded-Device\"" \
+ -DHG_LOG_DOMAIN="\"X11-Embedded-Device\"" \
$(CFLAGS) \
$(NULL)
libx11_embedded_device_la_LDFLAGS = \
diff --git a/hieroglyph/Makefile.am b/hieroglyph/Makefile.am
index 1d259db..c46e49a 100644
--- a/hieroglyph/Makefile.am
+++ b/hieroglyph/Makefile.am
@@ -1,7 +1,7 @@
NULL =
INCLUDES = \
- -DG_LOG_DOMAIN="\"Hieroglyph\"" \
+ -DHG_LOG_DOMAIN="\"Hieroglyph\"" \
-DHIEROGLYPH_DEVICEDIR="\"$(HIEROGLYPH_DEVICEDIR)\"" \
-DHIEROGLYPH_PLUGINDIR="\"$(HIEROGLYPH_PLUGINDIR)\"" \
-DHIEROGLYPH_CMAPDIR="\"$(HIEROGLYPH_CMAPDIR)\"" \
diff --git a/hieroglyph/hglog.c b/hieroglyph/hglog.c
index 329aeba..3a44c58 100644
--- a/hieroglyph/hglog.c
+++ b/hieroglyph/hglog.c
@@ -35,6 +35,7 @@
static void _hg_log_default_handler(HgLogType log_type,
+ const gchar *domain,
const gchar *subtype,
const gchar *message);
@@ -54,10 +55,12 @@ static HgLogFunc __hg_log_handler = _hg_log_default_handler;
*/
static void
_hg_log_default_handler(HgLogType log_type,
+ const gchar *domain,
const gchar *subtype,
const gchar *message)
{
HgFileObject *file;
+ gchar *header;
if (__hg_log_vm) {
file = hg_vm_get_io(__hg_log_vm, VM_IO_STDERR);
@@ -66,8 +69,9 @@ _hg_log_default_handler(HgLogType log_type,
hg_file_init();
file = __hg_file_stderr;
}
+ header = hg_log_get_log_type_header(log_type, domain);
hg_file_object_printf(file, "%s ***%s%s%s %s\n",
- log_type_to_string[log_type],
+ header,
(subtype ? " " : ""),
(subtype ? subtype : ""),
(subtype ? ":" : ""),
@@ -140,8 +144,23 @@ hg_log_set_default_handler(HgLogFunc func)
__hg_log_handler = func;
}
+gchar *
+hg_log_get_log_type_header(HgLogType log_type,
+ const gchar *domain)
+{
+ gchar *retval;
+
+ if (domain)
+ retval = g_strdup_printf("%s-%s", domain, log_type_to_string[log_type]);
+ else
+ retval = g_strdup(log_type_to_string[log_type]);
+
+ return retval;
+}
+
void
hg_log(HgLogType log_type,
+ const gchar *domain,
const gchar *subtype,
const gchar *format,
...)
@@ -149,12 +168,13 @@ hg_log(HgLogType log_type,
va_list ap;
va_start(ap, format);
- hg_logv(log_type, subtype, format, ap);
+ hg_logv(log_type, domain, subtype, format, ap);
va_end(ap);
}
void
hg_logv(HgLogType log_type,
+ const gchar *domain,
const gchar *subtype,
const gchar *format,
va_list va_args)
@@ -168,7 +188,7 @@ hg_logv(HgLogType log_type,
gchar *buffer = g_strdup_vprintf(format, va_args);
/* just invoke a default handler */
- __hg_log_handler(log_type, subtype, buffer);
+ __hg_log_handler(log_type, domain, subtype, buffer);
g_free(buffer);
return;
}
@@ -184,7 +204,7 @@ hg_logv(HgLogType log_type,
if (HG_IS_VALUE_BOOLEAN (node)) {
if (HG_VALUE_GET_BOOLEAN (node)) {
/* just invoke a default handler */
- __hg_log_handler(log_type, subtype, hg_string_get_string(string));
+ __hg_log_handler(log_type, domain, subtype, hg_string_get_string(string));
}
} else if (HG_IS_VALUE_OPERATOR (node) ||
(HG_IS_VALUE_ARRAY (node) && hg_object_is_executable((HgObject *)node))) {
diff --git a/hieroglyph/hglog.h b/hieroglyph/hglog.h
index c2aa462..b9b42d8 100644
--- a/hieroglyph/hglog.h
+++ b/hieroglyph/hglog.h
@@ -30,32 +30,37 @@ G_BEGIN_DECLS
typedef void (*HgLogFunc)(HgLogType log_type,
+ const gchar *domain,
const gchar *subtype,
const gchar *message);
-#define hg_log_info(...) \
- hg_log(HG_LOG_TYPE_INFO, NULL, __VA_ARGS__)
+#define hg_log_info(...) \
+ hg_log(HG_LOG_TYPE_INFO, HG_LOG_DOMAIN, NULL, __VA_ARGS__)
#ifdef DEBUG
-#define hg_log_debug(_type_, ...) \
- hg_log(HG_LOG_TYPE_DEBUG, (_type_), __VA_ARGS__)
+#define hg_log_debug(_type_, ...) \
+ hg_log(HG_LOG_TYPE_DEBUG, HG_LOG_DOMAIN, #_type_, __VA_ARGS__)
#else
#define hg_log_debug(_type_, ...)
#endif /* DEBUG */
-#define hg_log_warning(...) \
- hg_log(HG_LOG_TYPE_WARNING, NULL, __VA_ARGS__)
-#define hg_log_error(...) \
- hg_log(HG_LOG_TYPE_ERROR, NULL, __VA_ARGS__)
+#define hg_log_warning(...) \
+ hg_log(HG_LOG_TYPE_WARNING, HG_LOG_DOMAIN, NULL, __VA_ARGS__)
+#define hg_log_error(...) \
+ hg_log(HG_LOG_TYPE_ERROR, HG_LOG_DOMAIN, NULL, __VA_ARGS__)
gboolean hg_log_init (HgVM *vm,
HgDict *dict);
void hg_log_finalize (void);
void hg_log_set_default_handler(HgLogFunc func);
+gchar *hg_log_get_log_type_header(HgLogType log_type,
+ const gchar *domain) G_GNUC_MALLOC;
void hg_log (HgLogType log_type,
+ const gchar *domain,
const gchar *subtype,
const gchar *format,
...);
void hg_logv (HgLogType log_type,
+ const gchar *domain,
const gchar *subtype,
const gchar *format,
va_list va_args);
diff --git a/hieroglyph/version.h.in b/hieroglyph/version.h.in
index c649c61..8924588 100644
--- a/hieroglyph/version.h.in
+++ b/hieroglyph/version.h.in
@@ -29,7 +29,7 @@
G_BEGIN_DECLS
#define HIEROGLYPH_VERSION "@VERSION@"
-#define HIEROGLYPH_UUID "118f9f31-4fa8-45fa-9343-f9c124b0ab6c"
+#define HIEROGLYPH_UUID "cf4ff615-1777-464f-b68c-99ffdf8c3341"
const char *__hg_rcsid G_GNUC_UNUSED = "$Rev$";
diff --git a/plugins/debug/Makefile.am b/plugins/debug/Makefile.am
index f4d5455..b0f97e1 100644
--- a/plugins/debug/Makefile.am
+++ b/plugins/debug/Makefile.am
@@ -22,7 +22,7 @@ libext_debug_la_SOURCES = \
debug-main.c \
$(NULL)
libext_debug_la_CFLAGS = \
- -DG_LOG_DOMAIN="\"Debug-Extension\"" \
+ -DHG_LOG_DOMAIN="\"Debug-Extension\"" \
$(CFLAGS) \
$(NULL)
libext_debug_la_LDFLAGS = \
diff --git a/plugins/libedit/Makefile.am b/plugins/libedit/Makefile.am
index adf048a..ab18388 100644
--- a/plugins/libedit/Makefile.am
+++ b/plugins/libedit/Makefile.am
@@ -23,7 +23,7 @@ libext_libedit_la_SOURCES = \
libedit-main.c \
$(NULL)
libext_libedit_la_CFLAGS = \
- -DG_LOG_DOMAIN="\"Libedit-Extension\"" \
+ -DHG_LOG_DOMAIN="\"Libedit-Extension\"" \
$(CFLAGS) \
$(NULL)
libext_libedit_la_LDFLAGS = \
diff --git a/plugins/test/Makefile.am b/plugins/test/Makefile.am
index 0ef9760..24d098e 100644
--- a/plugins/test/Makefile.am
+++ b/plugins/test/Makefile.am
@@ -22,7 +22,7 @@ libext_test_la_SOURCES = \
test-main.c \
$(NULL)
libext_test_la_CFLAGS = \
- -DG_LOG_DOMAIN="\"Test-Extension\"" \
+ -DHG_LOG_DOMAIN="\"Test-Extension\"" \
$(CFLAGS) \
$(NULL)
libext_test_la_LDFLAGS = \