diff options
author | RALOVICH, Kristóf <tade60@freemail.hu> | 2013-03-26 18:51:43 +0100 |
---|---|---|
committer | RALOVICH, Kristóf <tade60@freemail.hu> | 2013-03-26 18:51:43 +0100 |
commit | 0c5adebcbb5f64ec8e8030b5208a8d41934c35b4 (patch) | |
tree | 26cc6fcdde959c7719a462de15f04dcf8492b6c9 /src/Log.hpp | |
parent | 472aafa9efc299a046a9b838d2b23c44fdade87f (diff) |
define NDEBUG in release
Debug flags for gcc
Diffstat (limited to 'src/Log.hpp')
-rw-r--r-- | src/Log.hpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Log.hpp b/src/Log.hpp index b5c08e1..db62926 100644 --- a/src/Log.hpp +++ b/src/Log.hpp @@ -40,11 +40,11 @@ namespace antpm LOG_DBG3 //< even more debug info (function trace, ) }; -#ifdef __PSO_DEBUG__ +#ifndef NDEBUG # define psoLogMaxLogLevel antpm::LOG_DBG3 -#else // !__PSO_DEBUG__ +#else # define psoLogMaxLogLevel antpm::LOG_INF -#endif // !__PSO_DEBUG__ +#endif inline const char* @@ -162,9 +162,13 @@ namespace antpm return; } - std::string old = std::string(logFileName) + std::string(".old"); - ::remove(old.c_str()); - ::rename(logFileName, old.c_str()); + // rotate previous log file + if(::access(logFileName, 0x00) != -1) + { + std::string old = std::string(logFileName) + std::string(".old"); + ::remove(old.c_str()); + ::rename(logFileName, old.c_str()); + } _ofs.open(logFileName, std::ios::out | std::ios::trunc); if(!_ofs.is_open()) |