Commit c19283a0 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[CHANGE] moved starting of WLogger to later point in time. This allows to

print stuff related to command line options before the logger prints
something. This seems reasonable, as the started logging suggests to the
user, that program really starts. Which it doesn't if you e.g. only call the
-h" option for command line usage.
parent 393ac30f
......@@ -51,17 +51,19 @@ int main( int argc, char** argv )
// install signal handler as early as possible
// init logger
// init logger here. It will be started by the GUI.
WLogger logger;;
// initialize GUI
// NOTE: we need a shared ptr here since WGUI uses enable_shared_from_this.
boost::shared_ptr< WQt4Gui > gui = boost::shared_ptr< WQt4Gui > ( new WQt4Gui( argc, argv ) );
int result = gui->run();
// finish running thread
// finish running thread if there is a WLogger.
if( !result )
WLogger::getLogger()->wait( true );
return result;
......@@ -89,15 +89,19 @@ int WQt4Gui::run()
std::cout << e.what() << std::endl;
return 1;
catch( boost::program_options::invalid_command_line_syntax e )
std::cout << e.what() << std::endl;
return 1;
// exit as fast as possible if command line asks for help.
// exit as fast as possible if command line asked for help. The ,essage has been printed by parseOptions().
if( m_optionsMap.count( "help" ) )
return 0;
return 1;
// TODO(all): In my (alex) opinion the WLogger should be started here and not before. This allows to generate a simple help message.
WLogger::getLogger()->addLogMessage( "Bringing up GUI", "GUI", LL_INFO );
QApplication appl( argc, argv, true );
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment