1 #ifndef __STDAIR_SVC_LOGGER_HPP
2 #define __STDAIR_SVC_LOGGER_HPP
16 #define STDAIR_LOG_CORE(iLevel, iToBeLogged) \
17 { std::ostringstream ostr; ostr << iToBeLogged; \
18 stdair::Logger::instance().log (iLevel, __LINE__, __FILE__, ostr.str()); }
20 #define STDAIR_LOG_CRITICAL(iToBeLogged) \
21 STDAIR_LOG_CORE (stdair::LOG::CRITICAL, iToBeLogged)
23 #define STDAIR_LOG_ERROR(iToBeLogged) \
24 STDAIR_LOG_CORE (stdair::LOG::ERROR, iToBeLogged)
26 #define STDAIR_LOG_NOTIFICATION(iToBeLogged) \
27 STDAIR_LOG_CORE (stdair::LOG::NOTIFICATION, iToBeLogged)
29 #define STDAIR_LOG_WARNING(iToBeLogged) \
30 STDAIR_LOG_CORE (stdair::LOG::WARNING, iToBeLogged)
32 #define STDAIR_LOG_DEBUG(iToBeLogged) \
33 STDAIR_LOG_CORE (stdair::LOG::DEBUG, iToBeLogged)
35 #define STDAIR_LOG_VERBOSE(iToBeLogged) \
36 STDAIR_LOG_CORE (stdair::LOG::VERBOSE, iToBeLogged)
60 const std::string& iFileName,
const T& iToBeLogged) {
61 assert (_logStream != NULL);
62 if (iLevel <= _level) {
63 *_logStream <<
"[" <<
LOG::_logLevels[iLevel] <<
"]" << iFileName <<
":"
64 << iLineNumber <<
": " << iToBeLogged << std::endl;
79 bool getStatus()
const {
80 return _hasBeenInitialised;
93 void setStream (std::ostream& ioStream) {
94 _logStream = &ioStream;
100 void setStatus (
const bool iStatus) {
101 _hasBeenInitialised = iStatus;
112 Logger (
const Logger&);
123 static void init (
const BasLogParams&);
128 static BasLogParams getLogParams();
146 std::ostream* _logStream;
151 bool _hasBeenInitialised;
155 #endif // __STDAIR_SVC_LOGGER_HPP
static const std::string _logLevels[LAST_VALUE]
Handle on the StdAir library context.
void log(const LOG::EN_LogLevel iLevel, const int iLineNumber, const std::string &iFileName, const T &iToBeLogged)
static Logger & instance()
Interface for the STDAIR Services.