+ fprintf(out, "%s", log_domain);
+ fprintf(out, "-");
+ fprintf(out, "%s", level);
+ fprintf(out, ": ");
+ fprintf(out, "%s", message);
+ fprintf(out, "\n");
+ fflush(out);
+}
+
+static void log_handler(const gchar *log_domain, GLogLevelFlags log_level,
+ const gchar *message, gpointer data)
+{
+ FILE *out;
+ const gchar *level;
+
+ switch (log_level & G_LOG_LEVEL_MASK) {
+ case G_LOG_LEVEL_DEBUG: level = "Debug"; out = stdout; break;
+ case G_LOG_LEVEL_INFO: level = "Info"; out = stdout; break;
+ case G_LOG_LEVEL_MESSAGE: level = "Message"; out = stdout; break;
+ case G_LOG_LEVEL_WARNING: level = "Warning"; out = stderr; break;
+ case G_LOG_LEVEL_CRITICAL: level = "Critical"; out = stderr; break;
+ case G_LOG_LEVEL_ERROR: level = "Error"; out = stderr; break;
+ default: g_assert_not_reached(); /* invalid level.. */
+ }
+
+ log_print(out, log_domain, level, message);
+ if (log_file) log_print(log_file, log_domain, level, message);
+}
+
+static void prompt_handler(const gchar *log_domain, GLogLevelFlags log_level,
+ const gchar *message, gpointer data)
+{
+ if (ob_state() == OB_STATE_RUNNING)
+ prompt_show_message(message, "Openbox", _("Close"));
+ else
+ log_handler(log_domain, log_level, message, data);
+}
+
+static inline void log_argv(ObDebugType type,
+ const gchar *format, va_list args)
+{
+ const gchar *prefix;
+ gchar *message;