Project

General

Profile

« Previous | Next » 

Revision eee13fa3

Added by david.sorber over 2 years ago

First mostly functional version; let's call it v0.1.0.

View differences:

src/Logger.h
// at compile time. This avoids the need for the previous CMake path length trick.
inline constexpr size_t PATH_OFFSET(const char* input)
{
// OTHER NOTE: this assumes truncating the file path after the "lib/"
// portion which is currently valid for LH source tree organization.
// OTHER NOTE: this assumes truncating the file path after the "src/"
// portion which is currently valid for copytool source tree organization.
const char* output = std::strstr(input, "src/");
if (output == nullptr)
{
......
// Enumeration representing the log severity levels
enum LOG_LEVEL {off=-1, error=0, warn=1, info=2, debug=3, trace=4};
// Regular BlnxLog definition, goes to the log file
#define BlnxLog(sev) BlackLynx::Lighthouse::Logger::getInstance(sev).internalLog() \
// Convenience LOG macro definition
#define LOG(sev) DBS::Logger::getInstance(sev).internalLog() \
<< &(__FILE__[PATH_OFFSET(__FILE__)]) << ":" << __LINE__ << "|"
class Logger
......
*/
static Logger& getInstance(
enum LOG_LEVEL sev,
CopyManagerOptions* configObj=nullptr)
CopyManagerOptions* optionsObj=nullptr)
{
static Logger instance(configObj);
static Logger instance(optionsObj);
if (sev >= 0)
{
// Lock our mutex and set the severity level
......
m_rloggerMutex.unlock();
}
/**
* Select the output stream based on the specified options
* @return
*/
inline std::ostream& getStream()
{
return (r_options.getLogToStderr() ? std::cerr : m_logFile);
}
/**
* Write a log message to the log file.
*

Also available in: Unified diff