X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDebug.cxx;h=3c712e7a0f2f1324db0339d15bc2d5b705ed086a;hb=35ee8ee8af32946514713d271177df8bb2298eb2;hp=ee5f72b545fb69c44ca30eaaa5031a09b8cd2c6c;hpb=46afb30d2d016a9b1581c7ee4ca96d614a35203c;p=gdcm.git diff --git a/src/gdcmDebug.cxx b/src/gdcmDebug.cxx index ee5f72b5..3c712e7a 100644 --- a/src/gdcmDebug.cxx +++ b/src/gdcmDebug.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDebug.cxx,v $ Language: C++ - Date: $Date: 2005/11/28 15:20:32 $ - Version: $Revision: 1.27 $ + Date: $Date: 2007/05/23 14:18:08 $ + Version: $Revision: 1.31 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -21,13 +21,14 @@ #include -namespace gdcm +namespace GDCM_NAME_SPACE { //----------------------------------------------------------------------------- // Warning message level to be displayed const int Debug::LINE_LENGTH = 79; bool Debug::DebugFlag = false; +bool Debug::LogFlag = false; bool Debug::WarningFlag = false; bool Debug::OutputToFile = false; @@ -66,12 +67,28 @@ void Debug::SetDebugFlag (bool flag) */ void Debug::SetWarningFlag (bool flag) { - // Cannot unset Warning flag if Debug flag is on. - if (flag == false && DebugFlag == true) - return; + // Cannot unset Warning flag if Debug flag is on or if LogFlag is on. + if (flag == false) + { + if (DebugFlag == true) + return; + if (LogFlag == true) + return; + } WarningFlag = flag; } +/** + * \brief Sets the log flag + * @param flag Set the log flag + */ +void Debug::SetLogFlag (bool flag) +{ + // To log oddities, both flags are necessary + WarningFlag = flag; + LogFlag = flag; +} + /** * \brief Accessor * @param flag whether we want to redirect to file @@ -118,11 +135,11 @@ std::ostream &Debug::GetOutput () return StandardStream; } -void Debug::SendToOutput(unsigned int type,std::string const &msg,const CommandManager *mgr) +void Debug::SendToOutput(unsigned int type,std::string const &msg,const Base *object) { bool executed=false; - if(mgr) - executed=mgr->ConstExecuteCommand(type,msg); + if( type != CMD_DEBUG && type != CMD_ASSERT ) + executed=CommandManager::ExecuteCommandConst(object,type,msg); if(!executed) GetOutput() << Command::GetCommandAsString(type) << ": " << msg;