import os
trace="local"
-if (os.environ["SALOME_trace"] == "with_logger"):
- trace="logger"
+if (os.environ.has_key("SALOME_trace")):
+ if (os.environ["SALOME_trace"] == "with_logger"):
+ trace="logger"
class SALOME_Trace :
def __init__(self):
} else if ( list_type_composants->length() > 1 ) {
SALOMEGUI_OpenWith* aDlg = new SALOMEGUI_OpenWith( this );
for (unsigned int ind = 0; ind < list_type_composants->length();ind++) {
- aDlg->addComponent( strdup(list_type_composants[ind]) );
+ QString compusername = getComponentUserName(strdup(list_type_composants[ind]));
+ if ( compusername.compare("") != 0 )
+ aDlg->addComponent( compusername );
}
int retVal = aDlg->exec();
#include "SALOME_Log.hxx"
-SALOME_Log::SALOME_Log()
+SALOME_Log* SALOME_Log::_singleton = 0;
+
+// log line size: if too short, log line is truncated, without crash...
+char SALOME_LogStr[1024];
+
+SALOME_Log::SALOME_Log(): ostrstream(SALOME_LogStr,sizeof(SALOME_LogStr))
{
+ //cerr << endl << "#-=-# " << endl;
}
SALOME_Log::~SALOME_Log()
{
}
-SALOME_Log& SALOME_Log::Instance()
+SALOME_Log* SALOME_Log::Instance()
{
- static SALOME_Log instance;
- return instance;
+ if (_singleton == 0) _singleton = new SALOME_Log();
+ return _singleton;
}
void SALOME_Log::putMessage(std::ostream& msg)
seekp(0);
}
+
class SALOME_Log : public ostrstream
{
-public:
- virtual ~SALOME_Log();
- static Standard_EXPORT SALOME_Log& Instance();
- Standard_EXPORT void putMessage(std::ostream& msg);
-
+private:
+ static SALOME_Log* _singleton;
protected:
//disable creation of instances: force use static SALOME_Log& Instance()
SALOME_Log();
+public:
+ virtual ~SALOME_Log();
+ static Standard_EXPORT SALOME_Log* Instance();
+ Standard_EXPORT void putMessage(std::ostream& msg);
};
-
#define SLog SALOME_Log::Instance()
#endif
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(Logger)
-// class SALOME_LoggerClient : public SALOME_Log
-// {
-// protected:
-// SALOME_Logger::Logger_var m_pInterfaceLogger; // object reference on Logger server
-// };
-
SALOME_Logger::Logger_ptr m_pInterfaceLogger; // object reference on Logger server
-SALOME_Log::SALOME_Log()
+SALOME_Log* SALOME_Log::_singleton = 0;
+
+// log line size: if too short, log line is truncated, without crash...
+char SALOME_LogStr[1024];
+
+SALOME_Log::SALOME_Log(): ostrstream(SALOME_LogStr,sizeof(SALOME_LogStr))
{
cout << "SALOME_LoggerClient: constructor" << endl;
//get reference on object reference from NS
{
}
-SALOME_Log& SALOME_Log::Instance()
+SALOME_Log* SALOME_Log::Instance()
{
- static SALOME_Log instance;
- return instance;
+ if (_singleton == 0) _singleton = new SALOME_Log();
+ return _singleton;
}
void SALOME_Log::putMessage(std::ostream& msg)
/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
-#define INFOS(msg) {SLog.putMessage(SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);}
-#define PYSCRIPT(msg) {SLog.putMessage(SLog<<"---PYSCRIPT--- "<<msg<<endl);}
+#define INFOS(msg) {SLog->putMessage(*SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);}
+#define PYSCRIPT(msg) {SLog->putMessage(*SLog<<"---PYSCRIPT--- "<<msg<<endl);}
/* --- To print date and time of compilation of current source --- */
#endif
#define INFOS_COMPILATION { \
- SLog.putMessage(\
- SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
+ SLog->putMessage(\
+ *SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
<< "COMPILED with " << COMPILER \
<< ", " << __DATE__ \
<< " at " << __TIME__ <<endl); }
/* --- the following MACROS are useful at debug time --- */
-#define MYTRACE SLog << "- Trace " << __FILE__ << " [" << __LINE__ << "] : "
+#define MYTRACE *SLog << "- Trace " << __FILE__ << " [" << __LINE__ << "] : "
-#define MESSAGE(msg) {SLog.putMessage( MYTRACE <<msg<<endl<<ends); }
-#define SCRUTE(var) {SLog.putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
+#define MESSAGE(msg) {SLog->putMessage( MYTRACE <<msg<<endl<<ends); }
+#define SCRUTE(var) {SLog->putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
-#define REPERE SLog << " --------------" << endl
+#define REPERE *SLog << " --------------" << endl
#define BEGIN_OF(msg) {REPERE;MYTRACE<<"Begin of: " <<msg<<endl;REPERE;}
#define END_OF(msg) {REPERE;MYTRACE<<"Normal end of: "<<msg<<endl;REPERE;}