From: Robert S. <the...@gm...> - 2007-11-21 07:09:20
|
Hi Paul, here are my comments to the patch. Paul Elms schrieb: + + if (user_config->m_log_errors) //Enable logging of stdout and stderr to logfile + { + std::string logoutfile =3D user_config->getConfigDir(); + logoutfile +=3D "/"; Please look up the C++ standard. There is some constant which contains the OS specific file separator. Please use this instead. + std::string logerrfile =3D logoutfile; + logoutfile +=3D "stdout.log"; + logerrfile +=3D "stderr.log"; + + freopen (logoutfile.c_str(),"w",stdout); + freopen (logerrfile.c_str(),"w",stderr); + } + @@ -372,6 +373,8 @@ readInput(reader, "fire", KC_FIRE, m_player[i]); readInput(reader, "lookBack", KC_LOOK_BACK, m_player[i]); } + //get whether to log errors to file + lisp->get("log-errors", m_log_errors); Just a cosmetic issue. Please move this code above the input reading where all other single variable reading code is. Generally I wonder whether it makes sense to have some simple logging facilities: A bunch of info, debug, log, err, warn method that is globally accessible and allows easy redirection to file and stdout/stderr as well as a simple mean to supress a certain level of output? There are also libraries which provide such functionality: lib4c++, gnu nana, ... What do the others think? Do we want some logging facilities? Regards Robert |