return FALSE;
}
+/**
+ * @brief Appends a user information message to the log window queue
+ * @param data The message
+ * @returns FALSE
+ *
+ * If the first word of the message is either "error" or "warning"
+ * (case insensitive) the message is color-coded appropriately
+ */
static gboolean log_normal_cb(gpointer data)
{
gchar *buf = data;
- log_window_append(buf, LOG_NORMAL);
+ gchar *buf_casefold = g_utf8_casefold(buf, -1);
+ gchar *error_casefold = g_utf8_casefold(_("error"), -1);
+ gchar *warning_casefold = g_utf8_casefold(_("warning"), -1);
+
+ if (buf_casefold == g_strstr_len(buf_casefold, -1, error_casefold))
+ {
+ log_window_append(buf, LOG_ERROR);
+ }
+ else if (buf_casefold == g_strstr_len(buf_casefold, -1, warning_casefold))
+ {
+ log_window_append(buf, LOG_WARN);
+ }
+ else
+ {
+ log_window_append(buf, LOG_NORMAL);
+ }
+
g_free(buf);
+ g_free(buf_casefold);
+ g_free(error_casefold);
+ g_free(warning_casefold);
return FALSE;
}
if (!ret_exec)
{
- print_term(buf_nl);
+ print_term(FALSE, buf_nl);
if (strcmp(domain, DOMAIN_INFO) == 0)
g_idle_add(log_normal_cb, buf_nl);
else
}
else
{
- print_term(buf_nl);
+ print_term(FALSE, buf_nl);
if (strcmp(domain, DOMAIN_INFO) == 0)
g_idle_add(log_normal_cb, buf_nl);
else
g_free(buf);
}
-void log_domain_print_debug(const gchar *domain, const gchar *file_name,
+void log_domain_print_debug(const gchar *domain, const gchar *file_name, const gchar *function_name,
int line_number, const gchar *format, ...)
{
va_list ap;
message = g_strdup_vprintf(format, ap);
va_end(ap);
- location = g_strdup_printf("%s:%d:", file_name, line_number);
+ if (options && options->log_window.timer_data)
+ {
+ location = g_strdup_printf("%s:%s:%s:%d:", get_exec_time(), file_name,
+ function_name, line_number);
+ }
+ else
+ {
+ location = g_strdup_printf("%s:%s:%d:", file_name, function_name, line_number);
+ }
+
buf = g_strconcat(location, message, NULL);
log_domain_print_message(domain,buf);
g_free(location);