+/**
+ * \brief Accessor to know whether debug info are redirected to file
+ */
+bool Debug::GetOutputToFile ()
+{
+ return OutputToFile;
+}
+
+/**
+ * \brief Set the filename the debug stream should be redirect to
+ * Settting a filename also sets DebugToFile to true
+ * @param filename File to redirect debug info
+ * Absolutely nothing is check. You have to pass in
+ * a correct filename
+ */
+void Debug::SetOutputFileName (std::string const &filename)
+{
+ OutputToFile = true; // Just in case ...
+ DebugFlag = true; // Just in case ...
+ if ( OutputFileStream.is_open() )
+ OutputFileStream.close();
+ OutputFileStream.open( filename.c_str() );
+}
+
+/**
+ * \brief Internal use only. Allow us to retrieve the static from anywhere
+ * in gdcm code
+ * @return Debug file
+ */
+std::ostream &Debug::GetOutput ()
+{
+ if(OutputToFile)
+ return OutputFileStream;
+ else
+ return StandardStream;
+}
+
+void Debug::SendToOutput(unsigned int type,std::string const &msg,const Base *object)
+{
+ bool executed=false;
+ if( type != CMD_DEBUG && type != CMD_ASSERT )
+ executed=CommandManager::ExecuteCommandConst(object,type,msg);
+
+ if(!executed)
+ GetOutput() << Command::GetCommandAsString(type) << ": " << msg;
+}