To write a new, custom Logger
class, you need to do the following:
- define your logger class and write the code that actually emits the log;
- define logger traits to characterize your logger.
A simplistic example (simplified version of Tomographer::Logger::FileLogger) of a logger is given below.
class StderrLogger;
template<>
struct LoggerTraits<StderrLogger> : DefaultLoggerTraits
{
enum {
IsThreadSafe = 1,
StaticMinimumImportanceLevel = -1
};
};
} }
{
public:
{
}
inline void setLevel(int level)
{
setLogLevel(level);
}
inline void emitLog(int level, const char * origin,
{
finalmsg = "ERROR: ";
finalmsg = "Warning: ";
}
}
};