diff options
author | Robey Pointer <robey@src.gnome.org> | 2000-11-21 08:49:21 +0000 |
---|---|---|
committer | Robey Pointer <robey@src.gnome.org> | 2000-11-21 08:49:21 +0000 |
commit | 464a5feaa08a8cb2029526dd67d45b3f663d5a7c (patch) | |
tree | 7cfd84120ae1ff022e1334b9ea14714d1517abff /nautilus-installer | |
parent | c82012c9ea09edc61bdc141b62b7f7956492a11f (diff) | |
download | nautilus-464a5feaa08a8cb2029526dd67d45b3f663d5a7c.tar.gz |
Stop spamming the console with crap before logging starts.
* nautilus-installer/src/installer.c: (early_log_catcher),
(catch_early_logs), (start_logging), (eazel_installer_initialize):
Stop spamming the console with crap before logging starts.
Diffstat (limited to 'nautilus-installer')
-rw-r--r-- | nautilus-installer/src/installer.c | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/nautilus-installer/src/installer.c b/nautilus-installer/src/installer.c index 669b428ae..661cc1259 100644 --- a/nautilus-installer/src/installer.c +++ b/nautilus-installer/src/installer.c @@ -115,7 +115,7 @@ typedef struct { #define D_RETRY_TITLE _("Just so you know...") #define D_EVIL_RETRY_LABEL _("A serious problem has been encountered, but we think we can\n" \ "fix it. We would like to try the following actions, but since it might\n" \ - "have undesireable sideeffects, you might want to skip to a install\n" \ + "have undesireable side effects, you might want to skip to an install\n" \ "where file conflicts are ignored. If not, just press next...") #define D_EVIL_RETRY_TITLE _("Serious problem encountered....") #define D_SPLASH_TITLE _("Welcome to the Eazel Installer!") @@ -1952,7 +1952,7 @@ eazel_installer_setup_texts (EazelInstaller *installer, destination = g_strdup_printf ("%s/%s", dest_dir, TEXT_LIST); - g_message ("Trying to contact Eazel services, ignore any 404 errors..."); + /* g_message ("Trying to contact Eazel services, ignore any 404 errors..."); */ if (! trilobite_fetch_uri_to_file (url, destination)) { /* try again with proxy config */ @@ -2010,6 +2010,37 @@ eazel_install_get_depends (EazelInstaller *installer, const char *dest_dir) } static void +early_log_catcher (const char *domain, GLogLevelFlags flags, const char *message) +{ + if (! installer_debug) { + return; + } + + if (flags & G_LOG_LEVEL_DEBUG) { + fprintf (stderr, "debug: %s\n", message); + } else if (flags & G_LOG_LEVEL_MESSAGE) { + fprintf (stderr, "%s\n", message); + } else if (flags & G_LOG_LEVEL_WARNING) { + fprintf (stderr, "warning: %s\n", message); + } else if (flags & G_LOG_LEVEL_ERROR) { + fprintf (stderr, "ERROR: %s\n", message); + } else { + /* ignore */ + } + fflush (stderr); +} + +/* call this almost immediately so that most log messages from libraries are caught */ +static void +catch_early_logs (void) +{ + g_log_set_handler (G_LOG_DOMAIN, + G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR, + (GLogFunc)early_log_catcher, + NULL); +} + +static void start_logging (EazelInstaller *installer) { int flags; @@ -2018,9 +2049,7 @@ start_logging (EazelInstaller *installer) struct stat statbuf, lstatbuf; char *filename; - if (installer_debug) { - eazel_install_log_to_stderr (installer->service, TRUE); - } + eazel_install_log_to_stderr (installer->service, installer_debug ? TRUE : FALSE); /* try opening our favorite logfile */ flags = O_WRONLY | O_CREAT | O_APPEND; @@ -2134,6 +2163,8 @@ eazel_installer_initialize (EazelInstaller *object) { g_assert (object != NULL); g_assert (IS_EAZEL_INSTALLER (object)); + catch_early_logs (); + installer = EAZEL_INSTALLER (object); /* we have to start SOMEWHERE. several errors could occur between now and when we finally get the @@ -2264,8 +2295,6 @@ eazel_installer_initialize (EazelInstaller *object) { return; } - /* now that we have text from the server, build up the other pages */ - if (installer_package==NULL) { installer->categories = parse_local_xml_package_list (package_destination, &splash_text, |