![]() |
PhoenixMock
1.8.7
Tools to split/merge/print mock used in Phoenix
|
Phoenix Logger. More...
#include <PLog.h>
Public Types | |
| enum | Level { DEBUG = 1, INFO = 2, WARNING = 3, ERROR = 4, CRITICAL = 5, ALWAYS = 6 } |
| Log level to be used in the logger. More... | |
| enum | Mode { FILE_ONLY, STRING_ONLY, STDOUT_ONLY, FILE_CAPTURE_STDOUT_STDERR, DISABLE } |
| Mode to be used on the logger. More... | |
Public Member Functions | |
| void | appendLog (std::stringstream &str) |
| Append the log (STRING_ONLY mode) into an other log. More... | |
| void | clear () |
| Clear the children of the current PLog. More... | |
| void | close () |
| Close the current PLog and its children. More... | |
| const std::string & | getFileName () const |
| Get the filename of the current log. More... | |
| std::ostream & | getLog (PLog::Level logLevel=PLog::INFO) |
| Write log into the PLog. More... | |
| PLog & | getLog (size_t threadIndex) |
| Get the PLog at given index. More... | |
| std::ostream & | getLogAlways () |
| Write always message into the PLog. More... | |
| std::ostream & | getLogCritical () |
| Write critical message into the PLog. More... | |
| std::ostream & | getLogDebug () |
| Write debug message into the PLog. More... | |
| std::ostream & | getLogError () |
| Write error message into the PLog. More... | |
| std::ofstream & | getLogFile () |
| Get the current log file. More... | |
| std::ostream & | getLogInfo () |
| Write info message into the PLog. More... | |
| PLog::Level | getLogLevel () const |
| Get the log level of the current PLog. More... | |
| std::stringstream & | getLogString () |
| Get the log string. More... | |
| std::ostream & | getLogWarning () |
| Write warning message into the PLog. More... | |
| PLog::Mode | getMode () const |
| Get the mode of the current PLog. More... | |
| size_t | getThreadIndex () const |
| Get the thread index of the current PLog. More... | |
| bool | open () |
| Open the current PLog and its children. More... | |
| PLog () | |
| Default constructor of PLog. More... | |
| void | resize (size_t nbThread) |
| Resize the number of cihldren log file. More... | |
| void | setFileName (const std::string &fileName) |
| Set the output filename of the current PLog. More... | |
| void | setLogLevel (PLog::Level logLevel) |
| Set the log level of the current PLog. More... | |
| void | setMode (PLog::Mode mode) |
| Set the mode of the current PLog. More... | |
| void | setThreadIndex (size_t threadIndex) |
| Set the thread index of the current PLog. More... | |
| virtual | ~PLog () |
| Destructor of PLog. More... | |
Private Member Functions | |
| void | allocateStream (std::streambuf *buffer) |
| Allocate the stream. More... | |
| void | initialisationPLog () |
| Initialisation function of the class PLog. More... | |
| bool | streamOpen () |
| Open the streams. More... | |
Private Attributes | |
| std::string | p_fileName |
| Output filename of the current PLog. More... | |
| bool | p_isOpen |
| True of the log is opened. More... | |
| std::ofstream | p_logFile |
| Current log file to be used. More... | |
| PLog::Level | p_logLevel |
| Current log level of the PLog (all log greater or equal to the p_logLevel will be logged) More... | |
| std::stringstream | p_logString |
| Log string. More... | |
| PLog::Mode | p_mode |
| Mode of the logger. More... | |
| std::ostream * | p_nullStream |
| Stream used to disable log output. More... | |
| std::streambuf * | p_oldStdCerrBuffer |
| Old std::cerr buffer. More... | |
| std::streambuf * | p_oldStdCoutBuffer |
| Old std::cout buffer. More... | |
| std::ostream * | p_stream |
| Current stream to be used to log things. More... | |
| size_t | p_threadIndex |
| Index of the current thread. More... | |
| std::vector< PLog * > | p_vecLog |
| Vector of sur log file to be used (mainly for multithreaded programs) More... | |
| enum PLog::Level |
| enum PLog::Mode |
| PLog::PLog | ( | ) |
Default constructor of PLog.
Definition at line 48 of file PLog.cpp.
References initialisationPLog().
Referenced by resize().
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
|
private |
| void PLog::appendLog | ( | std::stringstream & | str | ) |
Append the log (STRING_ONLY mode) into an other log.
| str | : log string to be appended |
Definition at line 170 of file PLog.cpp.
References ALWAYS, getLog(), and createReleaseCurl::str.
Referenced by testStringLogAppend().
Here is the call graph for this function:
Here is the caller graph for this function:| void PLog::clear | ( | ) |
| void PLog::close | ( | ) |
Close the current PLog and its children.
Definition at line 125 of file PLog.cpp.
References close(), getLogAlways(), p_isOpen, p_logFile, p_oldStdCerrBuffer, p_oldStdCoutBuffer, p_stream, p_vecLog, and phoenix_getDate().
Referenced by close(), testLogCoutDedirectInFile(), testLogDisable(), testLogStdoutOnly(), testStringLogAppend(), and ~PLog().
Here is the call graph for this function:
Here is the caller graph for this function:| const std::string & PLog::getFileName | ( | ) | const |
Get the filename of the current log.
Definition at line 254 of file PLog.cpp.
References p_fileName.
Referenced by testStringPLog(), and testStringPLogLevel().
Here is the caller graph for this function:| std::ostream & PLog::getLog | ( | PLog::Level | logLevel = PLog::INFO | ) |
Write log into the PLog.
| logLevel | : log level of the current line |
Definition at line 199 of file PLog.cpp.
References p_logLevel, p_nullStream, p_stream, p_threadIndex, phoenix_getDateCompact(), phoenix_getTime(), and phoenix_logLevelToStr().
Here is the call graph for this function:| PLog & PLog::getLog | ( | size_t | threadIndex | ) |
Get the PLog at given index.
Definition at line 177 of file PLog.cpp.
References p_vecLog.
Referenced by appendLog(), getLogAlways(), getLogCritical(), getLogDebug(), getLogError(), getLogInfo(), getLogWarning(), testLogCoutDedirectInFile(), testLogDisable(), testLogStdoutOnly(), testStringLogAppend(), testStringMultiPLog(), testStringPLog(), and testStringPLogLevel().
Here is the caller graph for this function:| std::ostream & PLog::getLogAlways | ( | ) |
| std::ostream & PLog::getLogCritical | ( | ) |
Write critical message into the PLog.
Definition at line 239 of file PLog.cpp.
References CRITICAL, and getLog().
Referenced by testStringLogAppend(), and testStringPLogLevel().
Here is the call graph for this function:
Here is the caller graph for this function:| std::ostream & PLog::getLogDebug | ( | ) |
Write debug message into the PLog.
Definition at line 211 of file PLog.cpp.
References DEBUG, and getLog().
Referenced by testStringLogAppend(), and testStringPLogLevel().
Here is the call graph for this function:
Here is the caller graph for this function:| std::ostream & PLog::getLogError | ( | ) |
Write error message into the PLog.
Definition at line 232 of file PLog.cpp.
References ERROR, and getLog().
Referenced by testStringLogAppend(), and testStringPLogLevel().
Here is the call graph for this function:
Here is the caller graph for this function:| std::ofstream & PLog::getLogFile | ( | ) |
| std::ostream & PLog::getLogInfo | ( | ) |
Write info message into the PLog.
Definition at line 218 of file PLog.cpp.
References getLog(), and INFO.
Referenced by testStringLogAppend(), and testStringPLogLevel().
Here is the call graph for this function:
Here is the caller graph for this function:| PLog::Level PLog::getLogLevel | ( | ) | const |
| std::stringstream & PLog::getLogString | ( | ) |
Get the log string.
Definition at line 191 of file PLog.cpp.
References p_logString.
Referenced by testStringLogAppend().
Here is the caller graph for this function:| std::ostream & PLog::getLogWarning | ( | ) |
Write warning message into the PLog.
Definition at line 225 of file PLog.cpp.
References getLog(), and WARNING.
Referenced by testStringLogAppend(), and testStringPLogLevel().
Here is the call graph for this function:
Here is the caller graph for this function:| PLog::Mode PLog::getMode | ( | ) | const |
| size_t PLog::getThreadIndex | ( | ) | const |
Get the thread index of the current PLog.
Definition at line 275 of file PLog.cpp.
References p_threadIndex.
Referenced by testStringPLog().
Here is the caller graph for this function:
|
private |
Initialisation function of the class PLog.
Definition at line 280 of file PLog.cpp.
References FILE_ONLY, INFO, p_isOpen, p_logLevel, p_mode, p_nullStream, p_oldStdCerrBuffer, p_oldStdCoutBuffer, p_stream, and p_threadIndex.
Referenced by PLog().
Here is the caller graph for this function:| bool PLog::open | ( | ) |
Open the current PLog and its children.
Definition at line 106 of file PLog.cpp.
References getLogAlways(), getLogLevel(), open(), p_isOpen, p_vecLog, phoenix_getDate(), phoenix_logLevelToStr(), and streamOpen().
Referenced by open(), testLogCoutDedirectInFile(), testLogDisable(), testLogStdoutOnly(), testStringLogAppend(), testStringMultiPLog(), testStringPLog(), and testStringPLogLevel().
Here is the call graph for this function:
Here is the caller graph for this function:| void PLog::resize | ( | size_t | nbThread | ) |
Resize the number of cihldren log file.
| nbThread | : number of sub log files to be created (typically the number of threads of a program) |
Definition at line 90 of file PLog.cpp.
References clear(), convertToString(), eraseExtension(), getExtention(), p_fileName, p_logLevel, p_mode, p_vecLog, and PLog().
Referenced by testStringMultiPLog().
Here is the call graph for this function:
Here is the caller graph for this function:| void PLog::setFileName | ( | const std::string & | fileName | ) |
Set the output filename of the current PLog.
| fileName | : output filename of the current PLog |
Definition at line 62 of file PLog.cpp.
References p_fileName.
Referenced by testLogCoutDedirectInFile(), testLogDisable(), testLogStdoutOnly(), testStringLogAppend(), testStringMultiPLog(), testStringPLog(), and testStringPLogLevel().
Here is the caller graph for this function:| void PLog::setLogLevel | ( | PLog::Level | logLevel | ) |
Set the log level of the current PLog.
| logLevel | : log level of the current PLog |
Definition at line 76 of file PLog.cpp.
References p_logLevel.
Referenced by testStringLogAppend(), and testStringPLogLevel().
Here is the caller graph for this function:| void PLog::setMode | ( | PLog::Mode | mode | ) |
Set the mode of the current PLog.
| mode | : mode of the current PLog |
Definition at line 69 of file PLog.cpp.
References p_mode.
Referenced by testLogCoutDedirectInFile(), testLogDisable(), testLogStdoutOnly(), and testStringLogAppend().
Here is the caller graph for this function:| void PLog::setThreadIndex | ( | size_t | threadIndex | ) |
Set the thread index of the current PLog.
| threadIndex | : thread index of the current PLog |
Definition at line 83 of file PLog.cpp.
References p_threadIndex.
Referenced by testStringLogAppend(), and testStringPLog().
Here is the caller graph for this function:
|
private |
Open the streams.
Definition at line 304 of file PLog.cpp.
References allocateStream(), DISABLE, FILE_CAPTURE_STDOUT_STDERR, FILE_ONLY, p_fileName, p_logFile, p_logString, p_mode, p_oldStdCerrBuffer, p_oldStdCoutBuffer, STDOUT_ONLY, and STRING_ONLY.
Referenced by open().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Output filename of the current PLog.
Definition at line 77 of file PLog.h.
Referenced by getFileName(), resize(), setFileName(), and streamOpen().
|
private |
True of the log is opened.
Definition at line 93 of file PLog.h.
Referenced by close(), initialisationPLog(), and open().
|
private |
Current log file to be used.
Definition at line 79 of file PLog.h.
Referenced by close(), getLogFile(), and streamOpen().
|
private |
Current log level of the PLog (all log greater or equal to the p_logLevel will be logged)
Definition at line 75 of file PLog.h.
Referenced by getLog(), getLogLevel(), initialisationPLog(), resize(), and setLogLevel().
|
private |
|
private |
Mode of the logger.
Definition at line 73 of file PLog.h.
Referenced by getMode(), initialisationPLog(), resize(), setMode(), and streamOpen().
|
private |
Stream used to disable log output.
Definition at line 85 of file PLog.h.
Referenced by getLog(), initialisationPLog(), and ~PLog().
|
private |
Old std::cerr buffer.
Definition at line 87 of file PLog.h.
Referenced by close(), initialisationPLog(), and streamOpen().
|
private |
Old std::cout buffer.
Definition at line 89 of file PLog.h.
Referenced by close(), initialisationPLog(), and streamOpen().
|
private |
Current stream to be used to log things.
Definition at line 83 of file PLog.h.
Referenced by allocateStream(), close(), getLog(), and initialisationPLog().
|
private |
Index of the current thread.
Definition at line 95 of file PLog.h.
Referenced by getLog(), getThreadIndex(), initialisationPLog(), and setThreadIndex().
|
private |