93 for(
size_t i(0lu); i < nbThread; ++i){
109 getLogAlways() <<
"[UTC][Date][ThreadIndex][LogLevel] : log message" << std::endl;
113 for(std::vector<PLog*>::iterator it(
p_vecLog.begin()); it !=
p_vecLog.end(); ++it){
144 for(std::vector<PLog*>::iterator it(
p_vecLog.begin()); it !=
p_vecLog.end(); ++it){
155 for(std::vector<PLog*>::iterator it(
p_vecLog.begin()); it !=
p_vecLog.end(); ++it){
303 p_stream =
new std::ostream(buffer);
318 std::cerr <<
"PLog::streamOpen : p_logString.rdbuf() = " <<
p_logString.rdbuf() << std::endl;
PString phoenix_logLevelToStr(PLog::Level logLevel)
Convert the log level into a PString.
PLog::Level phoenix_strToLogLevel(const PString &str)
Convert a string into a log level.
void setFileName(const PPath &fileName)
Set the output filename of the current PLog.
const PPath & getFileName() const
Get the filename of the current log.
void setThreadIndex(size_t threadIndex)
Set the thread index of the current PLog.
std::ostream & getLogAlways()
Write always message into the PLog.
void initialisationPLog()
Initialisation function of the class PLog.
PLog::Mode getMode() const
Get the mode of the current PLog.
void close()
Close the current PLog and its children.
Level
Log level to be used in the logger.
std::stringstream & getLogString()
Get the log string.
std::ostream * p_nullStream
Stream used to disable log output.
PLog::Level p_logLevel
Current log level of the PLog (all log greater or equal to the p_logLevel will be logged)
std::ostream * p_stream
Current stream to be used to log things.
std::ofstream p_logFile
Current log file to be used.
void resize(size_t nbThread)
Resize the number of cihldren log file.
void allocateStream(std::streambuf *buffer)
Allocate the stream.
std::vector< PLog * > p_vecLog
Vector of sur log file to be used (mainly for multithreaded programs)
size_t getThreadIndex() const
Get the thread index of the current PLog.
size_t p_threadIndex
Index of the current thread.
std::ostream & getLogDebug()
Write debug message into the PLog.
PPath p_fileName
Output filename of the current PLog.
PLog & getLog(size_t threadIndex)
Get the PLog at given index.
std::ostream & getLogInfo()
Write info message into the PLog.
void setMode(PLog::Mode mode)
Set the mode of the current PLog.
PLog()
Default constructor of PLog.
bool isOpen() const
Say if the current PLog is opened or not.
virtual ~PLog()
Destructor of PLog.
std::ostream & getLogWarning()
Write warning message into the PLog.
PLog::Level getLogLevel() const
Get the log level of the current PLog.
PLog::Mode p_mode
Mode of the logger.
std::streambuf * p_oldStdCoutBuffer
Old std::cout buffer.
Mode
Mode to be used on the logger.
@ FILE_CAPTURE_STDOUT_STDERR
bool streamOpen()
Open the streams.
std::stringstream p_logString
Log string.
bool p_isOpen
True of the log is opened.
std::streambuf * p_oldStdCerrBuffer
Old std::cerr buffer.
void setLogLevel(PLog::Level logLevel)
Set the log level of the current PLog.
bool open()
Open the current PLog and its children.
std::ostream & getLogCritical()
Write critical message into the PLog.
void appendLog(std::stringstream &str)
Append the log (STRING_ONLY mode) into an other log.
void clear()
Clear the children of the current PLog.
std::ofstream & getLogFile()
Get the current log file.
std::ostream & getLogError()
Write error message into the PLog.
Path of a directory or a file.
PPath & eraseExtension()
Erase the extension of the PPath.
PString getExtension() const
Get file extension.
std::string valueToString(const T &val)
Convert a type into a string.
PString phoenix_getDateCompact()
Get the current date.
time_t phoenix_getTime()
Get the current time of the program.
PString phoenix_getDate()
Get the current date.