From bfdcfc7949e01f47ee4d39de425a993033c413b0 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 30 Mar 2001 16:39:46 +0000 Subject: 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 --- shell/main.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'shell/main.c') 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 +#include #include #include #include @@ -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 (); -- cgit v1.2.3