r2638 - trunk/minisip/minisip/gui/gtkgui
mikma at minisip.org
mikma at minisip.org
Mon Jun 5 20:38:49 CEST 2006
Author: mikma
Date: 2006-06-05 20:38:47 +0200 (Mon, 05 Jun 2006)
New Revision: 2638
Modified:
trunk/minisip/minisip/gui/gtkgui/GtkMain.cxx
Log:
Redirect output to minisip.log when running in non-debug mode.
Modified: trunk/minisip/minisip/gui/gtkgui/GtkMain.cxx
===================================================================
--- trunk/minisip/minisip/gui/gtkgui/GtkMain.cxx 2006-06-05 18:37:13 UTC (rev 2637)
+++ trunk/minisip/minisip/gui/gtkgui/GtkMain.cxx 2006-06-05 18:38:47 UTC (rev 2638)
@@ -25,19 +25,33 @@
#include"GtkMainUI.h"
#include<libminisip/Minisip.h>
+#include<libminisip/configbackend/UserConfig.h>
#include<libmnetutil/TCPSocket.h>
using namespace std;
+static bool redirectOutput(const char *logName){
+ freopen(logName, "a", stdout);
+ freopen(logName, "a", stderr);
+ cerr << "Created log file" << endl;
+
+ return true;
+}
+
int main( int argc, char *argv[] )
{
+#if defined(DEBUG_OUTPUT) || !defined(WIN32)
cerr << endl << "Starting MiniSIP GTK ... welcome!" << endl << endl;
+#endif
setupDefaultSignalHandling(); //Signal handlers are created for all
//threads created with libmutil/Thread.h
//For the main thread we have to
//install them
+#ifndef DEBUG_OUTPUT
+ redirectOutput( UserConfig::getFileName( "minisip.log" ).c_str() );
+#endif
cerr << "Creating GTK GUI"<< endl;
MRef<Gui *> gui = GtkMainUI::create( argc, argv );
@@ -61,6 +75,12 @@
#endif // DEBUG_OUTPUT
minisip.runGui();
+
+#ifndef DEBUG_OUTPUT
+ merr.setExternalHandler( NULL );
+ mout.setExternalHandler( NULL );
+ mdbg.setExternalHandler( NULL );
+#endif
} else {
cerr << endl << "ERROR while starting SIP!" << endl << endl;
}
More information about the Minisip-devel
mailing list