diff options
author | Dan Winship <danw@src.gnome.org> | 2001-03-31 00:39:46 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-03-31 00:39:46 +0800 |
commit | bfdcfc7949e01f47ee4d39de425a993033c413b0 (patch) | |
tree | 2c088c5655c9c608fb4756da5f1fd6213b7b5212 /shell/main.c | |
parent | 911f4543a29d5a5ba99a5b1e6f9a847bc06fb78b (diff) | |
download | gsoc2013-evolution-bfdcfc7949e01f47ee4d39de425a993033c413b0.tar.gz gsoc2013-evolution-bfdcfc7949e01f47ee4d39de425a993033c413b0.tar.zst gsoc2013-evolution-bfdcfc7949e01f47ee4d39de425a993033c413b0.zip |
add a "debug" method to tell a component to output debugging messages to a
* Evolution-ShellComponent.idl: add a "debug" method to tell a
component to output debugging messages to a given file.
* main.c (main): Add a "--debug filename" argument, to direct
debugging output for all components to a file. Redirect the
shell's stdout/stderr to that file if this argument is used.
* evolution-shell-component-client.c
(evolution_shell_component_client_set_owner): If debug_log is set,
call the component's debug method as well.
* evolution-shell-component.c (impl_ShellComponent_debug):
redirect stdout/stderr to the named file and emit a "debug"
signal.
svn path=/trunk/; revision=9046
Diffstat (limited to 'shell/main.c')
-rw-r--r-- | shell/main.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/shell/main.c b/shell/main.c index c111b9faf1..dce135d9d9 100644 --- a/shell/main.c +++ b/shell/main.c @@ -22,6 +22,7 @@ */ #include <config.h> +#include <fcntl.h> #include <glib.h> #include <gtk/gtkmain.h> #include <gtk/gtklabel.h> @@ -50,6 +51,7 @@ static EShell *shell = NULL; static char *evolution_directory = NULL; static gboolean no_splash = FALSE; +char *debug_log = NULL; static void @@ -180,7 +182,8 @@ int main (int argc, char **argv) { struct poptOption options[] = { - { "no-splash", '\0', POPT_ARG_NONE, &no_splash, 0, N_("Disable."), NULL }, + { "no-splash", '\0', POPT_ARG_NONE, &no_splash, 0, N_("Disable splash screen"), NULL }, + { "debug", '\0', POPT_ARG_STRING, &debug_log, 0, N_("Send the debugging output of all components to a file."), NULL }, { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &oaf_popt_options, 0, NULL, NULL }, POPT_AUTOHELP { NULL, '\0', 0, NULL, 0, NULL, NULL } @@ -190,6 +193,19 @@ main (int argc, char **argv) textdomain (PACKAGE); gnome_init_with_popt_table ("Evolution", VERSION, argc, argv, options, 0, NULL); + + if (debug_log) { + int fd; + + fd = open (debug_log, O_WRONLY | O_CREAT | O_TRUNC, 0600); + if (fd) { + dup2 (fd, STDOUT_FILENO); + dup2 (fd, STDERR_FILENO); + close (fd); + } else + g_warning ("Could not set up debugging output file."); + } + oaf_init (argc, argv); glade_gnome_init (); |