33 #include <sys/types.h>
45 #ifdef CEPS_DEBUG_ENABLED
51 while ((optionChar=getopt(argc,argv,
"vqwph"))!=EOF)
87 auto now = std::time(
nullptr);
88 auto tm = *std::localtime(&now);
96 ss <<
"debug_" << getpid() <<
".log";
100 m_debugLog << std::string(77,
'-') << std::endl;
101 m_debugLog <<
" Debug log file opened at " << std::put_time(&tm,
"%d-%m-%Y %H-%M-%S")
103 m_debugLog << std::string(77,
'-') << std::endl;
110 auto now = std::time(
nullptr);
111 auto tm = *std::localtime(&now);
120 std::stringstream ss;
121 ss <<
"profiling_" << getpid() <<
".log";
125 m_profilingLog <<
"# Profiling log file opened at " << std::put_time(&tm,
"%d-%m-%Y %H-%M-%S")
157 auto now = std::time(
nullptr);
158 auto tm = *std::localtime(&now);
160 m_debugLog << std::string(77,
'-') << std::endl;
161 m_debugLog <<
" Debug log file closed at " << std::put_time(&tm,
"%d-%m-%Y %H-%M-%S")
163 m_debugLog << std::string(77,
'-') << std::endl;
176 m_profilingLog <<
"# Profiling log file closed at " << std::put_time(&tm,
"%d-%m-%Y %H-%M-%S")
209 std::cout <<
" Usage:\n " << argv[0] <<
" <paramFile>" << std::endl;
210 std::cout << std::string(77,
'-') << std::endl;
211 std::cout <<
" Options :" << std::endl
212 <<
" -v verbose mode, prints stuff on screen" << std::endl
213 <<
" -q quiet, no output on stdout (default)" << std::endl
214 <<
" -w prints all warnings" << std::endl
215 <<
" -p profiling mode, writes a profiling_XXXX.log file" << std::endl
216 <<
" -h prints this help and quits" << std::endl;
217 std::cout << std::string(77,
'-') << std::endl;
277 #ifdef CEPS_DEBUG_ENABLED
std::basic_string< CepsChar > CepsString
C++ format string.
Flags * flags
Global variable, used in every application.
Profiler * getProfiler() const
Access to profiler.
std::ofstream m_debugLog
Debug file stream (opened in init, closed at finalize)
void enableProfiling()
Activates profiling, opens profiling log stream.
CepsBool m_testing
Used for unit tests.
void disableWarnings()
Disables warning messages.
CepsBool warnings() const
True if option -w was set in command line.
std::ofstream & getDebugLog()
the Log stream
CepsBool testing() const
Tells if currently running in a test suite (switched in CepsGlobalFixture.hpp)
CepsString m_profilingLogName
Profiling file name.
CepsString getDebugLogName() const
Name has the form debug_PID.log (PID of master node)
std::ofstream m_profilingLog
Profiling file stream (opened in init, closed at finalize)
std::ofstream & getProfilingLog()
The Profiling stream.
void disableTesting()
Disables testing (CepsException for errors now cause abort)
CepsBool verbose() const
True if option -d was set in command line.
void printHelp(CepsChar **argv)
Display info on how to type in command line.
CepsString m_debugLogName
Debug file name.
CepsBool m_verbose
Blah blah if true.
CepsString getProfilingLogName() const
Name has the form profiling_PID.log (PID of master node)
void enableTesting()
Enables testing (CepsException for errors do not cause abort)
CepsBool m_warnings
More blah blah if true.
CepsBool m_profiling
Profiling option.
CepsBool profiling() const
True if option -p was set in command line.
~Flags()
If needed closes the logs with current time.
void enableDebug()
Activates profiling, opens debug log stream.
void enableWarnings()
Enables warning messages.
void setVerbose(CepsBool v)
Enable/disable verbosity.
void display(const CepsString &lbl, std::ostream &os) const
Prints time spent by a specific chronometer.
CepsBool isVerbose()
Check if the verbosity is enabled on the master proc (always false on slave procs).
std::ofstream & debugLog()
Get the DebugLog used in Ceps.
CepsBool isWarnings()
Check if we enable the warnings on the master proc (always false on slave procs).
CepsBool isMaster()
Is calling process the master ?
CepsBool isDebug()
Check if we enable the debug on the master proc (always false on slave procs).
std::ofstream & profilingLog()
Get the ProfilingLog used in Ceps.
void disableAbortOnError()
Set testing to true. Exceptions do not terminate program.
void enableAbortOnError()
Set testing to false. Exceptions terminate program.
CepsBool isProfiling()
Check if we are currently profiling on the master proc (always false on slave procs).