_moo_message()

master
Yevgen Muntyan 2006-11-02 00:38:00 -06:00
parent 1e6160a8af
commit e4baac44b7
15 changed files with 78 additions and 54 deletions

View File

@ -35,6 +35,7 @@
#include "mooapp/mooappinput.h" #include "mooapp/mooappinput.h"
#define MOO_APP_COMPILATION #define MOO_APP_COMPILATION
#include "mooapp/mooapp-private.h" #include "mooapp/mooapp-private.h"
#include "mooutils/mooutils-misc.h"
struct _MooAppInput struct _MooAppInput
@ -531,13 +532,9 @@ _moo_app_input_start (MooAppInput *ch)
ch->pipe_name = NULL; ch->pipe_name = NULL;
return FALSE; return FALSE;
} }
else
{ _moo_message ("%s: opened input pipe %s with fd %d",
#if 1
g_message ("%s: opened input pipe %s with fd %d",
G_STRLOC, ch->pipe_name, ch->pipe); G_STRLOC, ch->pipe_name, ch->pipe);
#endif
}
ch->io = g_io_channel_unix_new (ch->pipe); ch->io = g_io_channel_unix_new (ch->pipe);
g_io_channel_set_encoding (ch->io, NULL, NULL); g_io_channel_set_encoding (ch->io, NULL, NULL);

View File

@ -18,6 +18,7 @@
#include "mooedit/mooeditwindow.h" #include "mooedit/mooeditwindow.h"
#include "mooedit/moooutputfiltersimple.h" #include "mooedit/moooutputfiltersimple.h"
#include "mooedit/mooedit-enums.h" #include "mooedit/mooedit-enums.h"
#include "mooutils/mooutils-misc.h"
#include <gtk/gtkwindow.h> #include <gtk/gtkwindow.h>
#include <gtk/gtktextview.h> #include <gtk/gtktextview.h>
#include <string.h> #include <string.h>
@ -1142,7 +1143,7 @@ moo_command_filter_register (const char *id,
if (filter_lookup (id)) if (filter_lookup (id))
{ {
g_message ("reregistering filter '%s'", id); _moo_message ("reregistering filter '%s'", id);
moo_command_filter_unregister (id); moo_command_filter_unregister (id);
} }

View File

@ -16,6 +16,7 @@
#include "mooedit/mooeditprefs.h" #include "mooedit/mooeditprefs.h"
#include "mooutils/mooprefs.h" #include "mooutils/mooprefs.h"
#include "mooutils/eggregex.h" #include "mooutils/eggregex.h"
#include "mooutils/mooutils-misc.h"
#include <string.h> #include <string.h>
@ -193,7 +194,7 @@ filter_setting_match (FilterSetting *setting,
if (egg_regex_match (setting->regex, filename, 0)) if (egg_regex_match (setting->regex, filename, 0))
{ {
if (0) if (0)
g_message ("file '%s' matched pattern '%s': config '%s'", _moo_message ("file '%s' matched pattern '%s': config '%s'",
filename, egg_regex_get_pattern (setting->regex), filename, egg_regex_get_pattern (setting->regex),
setting->config); setting->config);
return setting->config; return setting->config;

View File

@ -14,6 +14,7 @@
#include "mooedit/moooutputfilter.h" #include "mooedit/moooutputfilter.h"
#include "mooedit/mooeditor.h" #include "mooedit/mooeditor.h"
#include "mooutils/moomarshals.h" #include "mooutils/moomarshals.h"
#include "mooutils/mooutils-misc.h"
#include <string.h> #include <string.h>
@ -359,12 +360,12 @@ moo_output_filter_open_file (MooOutputFilter *filter,
} }
else else
{ {
g_message ("file '%s' does not exist", path); _moo_message ("file '%s' does not exist", path);
} }
} }
else else
{ {
g_message ("could not find file '%s'", data->file); _moo_message ("could not find file '%s'", data->file);
} }
g_free (freeme); g_free (freeme);

View File

@ -381,7 +381,7 @@ _moo_plugin_finish_load (void)
while (waiting_list) while (waiting_list)
{ {
ModuleInfo *info = waiting_list->data; ModuleInfo *info = waiting_list->data;
g_message ("unknown module type '%s' in file %s", _moo_message ("unknown module type '%s' in file %s",
info->loader, info->ini_file); info->loader, info->ini_file);
module_info_free (info); module_info_free (info);
waiting_list = g_slist_delete_link (waiting_list, waiting_list); waiting_list = g_slist_delete_link (waiting_list, waiting_list);

View File

@ -282,7 +282,7 @@ moo_plugin_register (const char *id,
if (moo_plugin_lookup (moo_plugin_id (plugin))) if (moo_plugin_lookup (moo_plugin_id (plugin)))
{ {
g_message ("%s: plugin with id %s already registered", _moo_message ("%s: plugin with id %s already registered",
G_STRLOC, moo_plugin_id (plugin)); G_STRLOC, moo_plugin_id (plugin));
g_object_unref (plugin); g_object_unref (plugin);
return FALSE; return FALSE;

View File

@ -859,7 +859,7 @@ _moo_edit_save_user_tools (MooUserToolType type,
string = moo_key_file_format (key_file, "This file is autogenerated, do not edit", 2); string = moo_key_file_format (key_file, "This file is autogenerated, do not edit", 2);
g_message ("saving file %s", FILENAMES[type]); _moo_message ("saving file %s", FILENAMES[type]);
if (!moo_save_user_data_file (FILENAMES[type], string, -1, &error)) if (!moo_save_user_data_file (FILENAMES[type], string, -1, &error))
{ {
@ -867,7 +867,7 @@ _moo_edit_save_user_tools (MooUserToolType type,
g_error_free (error); g_error_free (error);
} }
g_message ("done"); _moo_message ("done");
g_free (string); g_free (string);
moo_key_file_unref (key_file); moo_key_file_unref (key_file);

View File

@ -30,6 +30,7 @@
#include "moofileview/moofile-private.h" #include "moofileview/moofile-private.h"
#include "moofileview/symlink.h" #include "moofileview/symlink.h"
#include "mooutils/mooutils-fs.h" #include "mooutils/mooutils-fs.h"
#include "mooutils/mooutils-misc.h"
#include "mooutils/moomarshals.h" #include "mooutils/moomarshals.h"
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
@ -658,7 +659,7 @@ get_mime_type (MooFile *file,
{ {
/* this should not happen */ /* this should not happen */
if (0) if (0)
g_message ("%s: oops, %s", G_STRLOC, file->display_name); _moo_message ("%s: oops, %s", G_STRLOC, file->display_name);
file->mime_type = MIME_TYPE_UNKNOWN; file->mime_type = MIME_TYPE_UNKNOWN;
} }
@ -1283,7 +1284,7 @@ moo_file_stat_unix (MooFile *file,
if (errno == ENOENT) if (errno == ENOENT)
{ {
gchar *display_name = g_filename_display_name (fullname); gchar *display_name = g_filename_display_name (fullname);
g_message ("%s: file '%s' does not exist", _moo_message ("%s: file '%s' does not exist",
G_STRLOC, display_name); G_STRLOC, display_name);
g_free (display_name); g_free (display_name);
file->info = 0; file->info = 0;
@ -1292,7 +1293,7 @@ moo_file_stat_unix (MooFile *file,
{ {
int save_errno = errno; int save_errno = errno;
gchar *display_name = g_filename_display_name (fullname); gchar *display_name = g_filename_display_name (fullname);
g_message ("%s: error getting information for '%s': %s", _moo_message ("%s: error getting information for '%s': %s",
G_STRLOC, display_name, G_STRLOC, display_name,
g_strerror (save_errno)); g_strerror (save_errno));
g_free (display_name); g_free (display_name);
@ -1315,7 +1316,7 @@ moo_file_stat_unix (MooFile *file,
if (errno == ENOENT) if (errno == ENOENT)
{ {
gchar *display_name = g_filename_display_name (fullname); gchar *display_name = g_filename_display_name (fullname);
g_message ("%s: file '%s' is a broken link", _moo_message ("%s: file '%s' is a broken link",
G_STRLOC, display_name); G_STRLOC, display_name);
g_free (display_name); g_free (display_name);
file->info = MOO_FILE_INFO_IS_LINK; file->info = MOO_FILE_INFO_IS_LINK;
@ -1324,7 +1325,7 @@ moo_file_stat_unix (MooFile *file,
{ {
int save_errno = errno; int save_errno = errno;
gchar *display_name = g_filename_display_name (fullname); gchar *display_name = g_filename_display_name (fullname);
g_message ("%s: error getting information for '%s': %s", _moo_message ("%s: error getting information for '%s': %s",
G_STRLOC, display_name, G_STRLOC, display_name,
g_strerror (save_errno)); g_strerror (save_errno));
g_free (display_name); g_free (display_name);
@ -1339,7 +1340,7 @@ moo_file_stat_unix (MooFile *file,
{ {
int save_errno = errno; int save_errno = errno;
gchar *display_name = g_filename_display_name (fullname); gchar *display_name = g_filename_display_name (fullname);
g_message ("%s: error getting link target for '%s': %s", _moo_message ("%s: error getting link target for '%s': %s",
G_STRLOC, display_name, G_STRLOC, display_name,
g_strerror (save_errno)); g_strerror (save_errno));
g_free (display_name); g_free (display_name);
@ -2268,7 +2269,7 @@ _create_icon_for_mime_type (GtkIconTheme *icon_theme,
return pixbuf; return pixbuf;
#endif #endif
g_message ("%s: could not find icon for mime type '%s'", _moo_message ("%s: could not find icon for mime type '%s'",
G_STRLOC, mime_type); G_STRLOC, mime_type);
return _create_icon_simple (icon_theme, MOO_ICON_FILE, NULL, return _create_icon_simple (icon_theme, MOO_ICON_FILE, NULL,
widget, size); widget, size);

View File

@ -20,6 +20,7 @@
#include "moofileview-aux.h" #include "moofileview-aux.h"
#include "mooutils/moomarshals.h" #include "mooutils/moomarshals.h"
#include "mooutils/mooutils-gobject.h" #include "mooutils/mooutils-gobject.h"
#include "mooutils/mooutils-misc.h"
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -535,8 +536,8 @@ completion_parse_text (MooFileEntryCompletion *cmpl,
path, &dirname, &display_dirname, path, &dirname, &display_dirname,
&display_basename, &error)) &display_basename, &error))
{ {
g_message ("%s: could not parse path '%s'", G_STRLOC, path); _moo_message ("%s: could not parse path '%s'", G_STRLOC, path);
g_message ("%s: %s", G_STRLOC, error->message); _moo_message ("%s: %s", G_STRLOC, error->message);
goto out; goto out;
} }
@ -564,8 +565,8 @@ completion_parse_text (MooFileEntryCompletion *cmpl,
&error); &error);
if (!folder) if (!folder)
{ {
g_message ("%s: could not get folder '%s'", G_STRLOC, dirname); _moo_message ("%s: could not get folder '%s'", G_STRLOC, dirname);
g_message ("%s: %s", G_STRLOC, error->message); _moo_message ("%s: %s", G_STRLOC, error->message);
g_error_free (error); g_error_free (error);
goto out; goto out;
} }

View File

@ -3059,11 +3059,11 @@ file_view_create_folder (MooFileView *fileview)
if (!path) if (!path)
{ {
g_message ("%s: could not make path for '%s'", G_STRLOC, name); _moo_message ("%s: could not make path for '%s'", G_STRLOC, name);
if (error) if (error)
{ {
g_message ("%s: %s", G_STRLOC, error->message); _moo_message ("%s: %s", G_STRLOC, error->message);
g_error_free (error); g_error_free (error);
} }
@ -3072,11 +3072,11 @@ file_view_create_folder (MooFileView *fileview)
if (!_moo_file_system_create_folder (fileview->priv->file_system, path, &error)) if (!_moo_file_system_create_folder (fileview->priv->file_system, path, &error))
{ {
g_message ("%s: could not create folder '%s'", G_STRLOC, name); _moo_message ("%s: could not create folder '%s'", G_STRLOC, name);
if (error) if (error)
{ {
g_message ("%s: %s", G_STRLOC, error->message); _moo_message ("%s: %s", G_STRLOC, error->message);
g_error_free (error); g_error_free (error);
} }

View File

@ -243,7 +243,7 @@ enum {
case 104: \ case 104: \
case 106: \ case 106: \
case 1001: \ case 1001: \
g_message ("%s: IGNORING mode %d", \ _moo_message ("%s: IGNORING mode %d", \
G_STRLOC, code); \ G_STRLOC, code); \
break; \ break; \
\ \

View File

@ -21,6 +21,7 @@
#include "mooutils/moocompat.h" #include "mooutils/moocompat.h"
#include "mooutils/moomarshals.h" #include "mooutils/moomarshals.h"
#include "mooutils/mooutils-gobject.h" #include "mooutils/mooutils-gobject.h"
#include "mooutils/mooutils-misc.h"
#include <string.h> #include <string.h>

View File

@ -21,6 +21,7 @@
#include "mooterm/pty.h" #include "mooterm/pty.h"
#include "mooutils/moomarshals.h" #include "mooutils/moomarshals.h"
#include "mooutils/moocompat.h" #include "mooutils/moocompat.h"
#include "mooutils/mooutils-misc.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
@ -235,7 +236,8 @@ fork_argv (MooTermPt *pt_gen,
else else
{ {
#if 1 #if 1
g_message ("%s: forked child pid %d on fd %d", G_STRLOC, pt->child_pid, pt->master); _moo_message ("%s: forked child pid %d on fd %d",
G_STRLOC, pt->child_pid, pt->master);
#endif #endif
} }
@ -344,7 +346,7 @@ read_child_out (G_GNUC_UNUSED GIOChannel *source,
{ {
int bytes; int bytes;
g_message ("%s: G_IO_HUP", G_STRLOC); _moo_message ("%s: G_IO_HUP", G_STRLOC);
error_no = errno; error_no = errno;
bytes = read (pt->master, buf, sizeof (buf)); bytes = read (pt->master, buf, sizeof (buf));
@ -356,7 +358,7 @@ read_child_out (G_GNUC_UNUSED GIOChannel *source,
} }
else if (condition & G_IO_ERR) else if (condition & G_IO_ERR)
{ {
g_message ("%s: G_IO_ERR", G_STRLOC); _moo_message ("%s: G_IO_ERR", G_STRLOC);
error_no = errno; error_no = errno;
goto error; goto error;
} }
@ -369,7 +371,7 @@ read_child_out (G_GNUC_UNUSED GIOChannel *source,
if (!to_read) if (!to_read)
{ {
if (0) if (0)
g_print ("read_child_out: skipping\n"); _moo_message ("read_child_out: skipping\n");
return TRUE; return TRUE;
} }
@ -482,10 +484,10 @@ read_child_out (G_GNUC_UNUSED GIOChannel *source,
error: error:
if (error_occured) if (error_occured)
g_message ("error in %s", G_STRLOC); _moo_message ("error in %s", G_STRLOC);
if (error_no) if (error_no)
g_message ("%s: %s", G_STRLOC, g_strerror (error_no)); _moo_message ("%s: %s", G_STRLOC, g_strerror (error_no));
if (pt->io) if (pt->io)
{ {
@ -651,9 +653,9 @@ static void pt_write (MooTermPt *pt,
} }
else else
{ {
g_message ("%s: stopping writing to child", G_STRLOC); _moo_message ("%s: stopping writing to child", G_STRLOC);
if (err) if (err)
g_message ("%s: %s", G_STRLOC, g_strerror (err)); _moo_message ("%s: %s", G_STRLOC, g_strerror (err));
kill_child (pt); kill_child (pt);
} }
} }

View File

@ -1589,6 +1589,7 @@ moo_data_dir_type_get_type (void)
gboolean gboolean
_moo_debug_enabled (void) _moo_debug_enabled (void)
{ {
#ifndef MOO_DEBUG
static gboolean enabled; static gboolean enabled;
static gboolean been_here; static gboolean been_here;
@ -1599,6 +1600,23 @@ _moo_debug_enabled (void)
} }
return enabled; return enabled;
#else
return TRUE;
#endif
}
void
_moo_message (const char *format,
...)
{
if (_moo_debug_enabled ())
{
va_list args;
va_start (args, format);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, args);
va_end (args);
}
} }

View File

@ -47,9 +47,10 @@ void moo_set_log_func_file (const char *log_file);
void moo_set_log_func_silent (void); void moo_set_log_func_silent (void);
void moo_reset_log_func (void); void moo_reset_log_func (void);
void moo_segfault (void); void moo_segfault (void);
gboolean _moo_debug_enabled (void) G_GNUC_CONST; gboolean _moo_debug_enabled (void) G_GNUC_CONST;
void _moo_message (const char *format,
...);
void _moo_disable_win32_error_message(void); void _moo_disable_win32_error_message(void);
void _moo_enable_win32_error_message (void); void _moo_enable_win32_error_message (void);