34#define QwOut gQwLog(QwLog::kAlways,__PRETTY_FUNCTION__)
39#define QwError gQwLog(QwLog::kError,__PRETTY_FUNCTION__)
44#define QwWarning gQwLog(QwLog::kWarning,__PRETTY_FUNCTION__)
49#define QwMessage gQwLog(QwLog::kMessage,__PRETTY_FUNCTION__)
54#define QwVerbose if (gQwLog.GetLogLevel() >= QwLog::kVerbose) gQwLog(QwLog::kVerbose,__PRETTY_FUNCTION__)
59#define QwDebug if (gQwLog.GetLogLevel() >= QwLog::kDebug) gQwLog(QwLog::kDebug,__PRETTY_FUNCTION__)
73class QwLog :
public std::ostream {
99 static const std::ios_base::openmode
kAppend;
115 void InitLogFile(
const std::string name,
const std::ios_base::openmode mode =
kAppend);
138 const std::string func_sig =
"<unknown>");
161 static std::ostream&
endl(std::ostream&);
165 static std::ostream&
flush(std::ostream&);
ANSI color codes and color management for terminal output.
Basic data types and constants used throughout the Qweak analysis framework.
Logging and output management system with configurable verbosity levels.
QwLogLevel fLogLevel
Log level of this stream.
void ProcessOptions(QwOptions *options)
Process class options for QwOptions.
std::map< std::string, bool > fIsDebugFunction
List of regular expressions for functions that will have increased log level.
bool fPrintFunctionSignature
Flag to print function signature on warning or error.
static bool fScreenInColor
bool fUseColor
Flag to disable color.
static bool fFileAtNewLine
Flags only relevant for current line, but static for use in static function.
QwLog & operator()(const QwLogLevel level, const std::string func_sig="<unknown>")
Set the stream log level.
QwLog & operator<<(const T &t)
Stream an object to the output stream.
void SetFileThreshold(int thr)
Set the file log level.
~QwLog() override
The destructor.
static const std::ios_base::openmode kTruncate
Log file open modes.
void SetScreenThreshold(int thr)
Set the screen log level.
QwLogLevel fScreenThreshold
Screen thresholds and stream.
static std::ostream & flush(std::ostream &)
Flush the streams.
const char * GetTime()
Get the local time.
static bool fScreenAtNewLine
static std::ostream & endl(std::ostream &)
End of the line.
void InitLogFile(const std::string name, const std::ios_base::openmode mode=kAppend)
Initialize the log file with name 'name'.
bool IsDebugFunction(const string func_name)
Determine whether the function name matches a specified list of regular expressions.
QwLogLevel fFileThreshold
File thresholds and stream.
static const std::ios_base::openmode kAppend
void SetScreenColor(bool flag)
Set the screen color mode.
static void DefineOptions(QwOptions *options)
Define available class options for QwOptions.
std::vector< std::string > fDebugFunctionRegexString
QwLogLevel GetLogLevel() const
Get highest log level.
Command-line and configuration file options processor.