34 #define INCLXX_IN_GEANT4_MODE 1
41 #ifdef INCLXX_IN_GEANT4_MODE
46 #if defined(INCL_DEBUG_LOG) && !defined(INCLXX_IN_GEANT4_MODE)
49 return std::string(
"Error");
51 return std::string (
"Fatal");
53 return std::string(
"Warning");
55 return std::string(
"Debug");
57 return std::string(
"");
59 return std::string(
"DataBlock");
61 return std::string(
"Unknown");
64 void LoggerSlave::logMessage(
const MessageType type,
const std::string &fileName,
const G4int lineNumber, std::string
const &
s,
const G4bool prefixHash)
const {
65 std::string cont = (prefixHash ?
"\n# " :
"\n");
66 std::string header = (prefixHash ?
"# " :
"");
68 std::stringstream headerss;
69 headerss << typeToString(type) <<
" [";
70 cont += headerss.str();
72 fileName.substr(fileName.find_last_of(
"/")+1) <<
73 ":" << lineNumber <<
"] ";
74 header += headerss.str();
75 cont.append(header.size() - cont.size() - 1,
'.');
80 String::replaceAll(message,
"\n", cont, s.size()-2);
81 (*logStream) << header <<
message;
86 void LoggerSlave::logDataBlock(
const std::string &
block,
const std::string &fileName,
const G4int lineNumber)
const {
88 fileName.substr(fileName.find_last_of(
"/")+1) <<
89 ":" << lineNumber <<
"] " <<
'\n'
101 void logMessage(
const MessageType type, std::string
const &fileName,
const G4int lineNumber, std::string
const &s,
const G4bool prefixHash) {
103 theLoggerSlave->logMessage(type, fileName, lineNumber, s, prefixHash);
108 theLoggerSlave->flush();
111 void dataBlock(
const std::string &block,
const std::string &fileName,
const G4int lineNumber) {
112 theLoggerSlave->logDataBlock(block, fileName, lineNumber);
115 void setLoggerSlave(LoggerSlave *
const logger) { theLoggerSlave = logger; }
117 void setVerbosityLevel(
G4int lvl) {
119 theLoggerSlave->setVerbosityLevel(lvl);
124 return theLoggerSlave->getVerbosityLevel();
129 void deleteLoggerSlave() {
130 delete theLoggerSlave;
134 void initialize(Config
const *
const theConfig) {
135 setLoggerSlave(
new LoggerSlave(theConfig->getLogFileName(), theConfig->getVerbosity()));
140 #else // defined(INCL_DEBUG_LOG) && !defined(INCLXX_IN_GEANT4_MODE)
149 const char *
const envVar = getenv(
"G4INCL_DEBUG_VERBOSITY");
151 std::stringstream verbss(envVar);
152 verbss >> verbosityLevel;
159 return verbosityLevel;
164 #endif // defined(INCL_DEBUG_LOG) && !defined(INCLXX_IN_GEANT4_MODE)
G4int getVerbosityLevel()
void message(RunManager *runmanager)
void initVerbosityLevelFromEnvvar()
void initialize(Config const *const theConfig)
Initialize the clustering model based on the Config object.