15 #ifndef _SAG_PLUGIN_LOGGING_HPP_ 16 #define _SAG_PLUGIN_LOGGING_HPP_ 21 namespace softwareag {
22 namespace _DATAT_INTERNAL_CPP_NAMESPACE {
32 friend class CacheForThisThread;
53 class CacheForThisThread
57 CacheForThisThread(CacheOwner &owner);
59 ~CacheForThisThread();
79 Logger(
const std::string &category): category(category), prefix(category), cachedLevel(getLevelImpl()) {}
87 template<level_t LEVEL,
typename... ARGS>
88 void log(
const char *format, ARGS... args)
const;
97 template<
typename... ARGS>
98 void log(level_t LEVEL,
const char *format, ARGS... args)
const;
106 template<level_t LEVEL,
typename... ARGS>
107 void log(
const std::string &format, ARGS... args)
const;
116 template<
typename... ARGS>
117 void log(level_t LEVEL,
const std::string &format, ARGS... args)
const;
123 return LEVEL <= getLevel();
147 template<
typename... ARGS>
void crit(
const char *format, ARGS... args)
const { log<SAG_LOG_CRIT>(format, args...); }
149 template<
typename... ARGS>
void fatal(
const char *format, ARGS... args)
const { log<SAG_LOG_FATAL>(format, args...); }
151 template<
typename... ARGS>
void error(
const char *format, ARGS... args)
const { log<SAG_LOG_ERROR>(format, args...); }
153 template<
typename... ARGS>
void warn(
const char *format, ARGS... args)
const { log<SAG_LOG_WARN>(format, args...); }
155 template<
typename... ARGS>
void info(
const char *format, ARGS... args)
const { log<SAG_LOG_INFO>(format, args...); }
157 template<
typename... ARGS>
void debug(
const char *format, ARGS... args)
const { log<SAG_LOG_DEBUG>(format, args...); }
159 template<
typename... ARGS>
void trace(
const char *format, ARGS... args)
const { log<SAG_LOG_TRACE>(format, args...); }
162 template<
typename... ARGS>
void crit(
const std::string &format, ARGS... args)
const { log<SAG_LOG_CRIT>(format, args...); }
164 template<
typename... ARGS>
void fatal(
const std::string &format, ARGS... args)
const { log<SAG_LOG_FATAL>(format, args...); }
166 template<
typename... ARGS>
void error(
const std::string &format, ARGS... args)
const { log<SAG_LOG_ERROR>(format, args...); }
168 template<
typename... ARGS>
void warn(
const std::string &format, ARGS... args)
const { log<SAG_LOG_WARN>(format, args...); }
170 template<
typename... ARGS>
void info(
const std::string &format, ARGS... args)
const { log<SAG_LOG_INFO>(format, args...); }
172 template<
typename... ARGS>
void debug(
const std::string &format, ARGS... args)
const { log<SAG_LOG_DEBUG>(format, args...); }
174 template<
typename... ARGS>
void trace(
const std::string &format, ARGS... args)
const { log<SAG_LOG_TRACE>(format, args...); }
175 const std::string &getPrefix()
const {
return prefix; }
178 level_t getLevelImpl()
const;
179 std::string category;
186 namespace connectivity {
using namespace _DATAT_INTERNAL_CPP_NAMESPACE; }
191 #include <sag_internal/logging.hpp> 193 #endif // _SAG_PLUGIN_LOGGING_HPP_ bool isEnabled(level_t LEVEL) const
Returns true if messages at the given level will be written to the log file.
Definition: sag_plugin_logging.hpp:121
void warn(const std::string &format, ARGS... args) const
Log a message at WARN level.
Definition: sag_plugin_logging.hpp:168
Fatal errors.
Definition: sag_connectivity_c.h:86
Class for writing to the system logger.
Definition: sag_plugin_logging.hpp:72
bool isCritEnabled() const
Returns true if CRIT messages will be written to the log.
Definition: sag_plugin_logging.hpp:132
void debug(const char *format, ARGS... args) const
Log a message at DEBUG level.
Definition: sag_plugin_logging.hpp:157
Trace.
Definition: sag_connectivity_c.h:96
void error(const std::string &format, ARGS... args) const
Log a message at ERROR level.
Definition: sag_plugin_logging.hpp:166
void error(const char *format, ARGS... args) const
Log a message at ERROR level.
Definition: sag_plugin_logging.hpp:151
sag_log_level_t level_t
The available log levels.
Definition: sag_plugin_logging.hpp:76
bool isWarnEnabled() const
Returns true if WARN messages will be written to the log.
Definition: sag_plugin_logging.hpp:138
void info(const std::string &format, ARGS... args) const
Log a message at INFO level.
Definition: sag_plugin_logging.hpp:170
Debug messages.
Definition: sag_connectivity_c.h:94
Critical log messages.
Definition: sag_connectivity_c.h:84
void trace(const std::string &format, ARGS... args) const
Log a message at TRACE level.
Definition: sag_plugin_logging.hpp:174
level_t getLevel() const
Returns the current log level.
Definition: sag_plugin_logging.hpp:127
sag_log_level_t
Log levels for logging to the host log file.
Definition: sag_connectivity_c.h:81
Non-fatal errors.
Definition: sag_connectivity_c.h:88
void warn(const char *format, ARGS... args) const
Log a message at WARN level.
Definition: sag_plugin_logging.hpp:153
Logger(const std::string &category)
Construct a logger for the given category.
Definition: sag_plugin_logging.hpp:79
Informational messages (default)
Definition: sag_connectivity_c.h:92
bool isTraceEnabled() const
Returns true if TRACE messages will be written to the log.
Definition: sag_plugin_logging.hpp:144
void info(const char *format, ARGS... args) const
Log a message at INFO level.
Definition: sag_plugin_logging.hpp:155
bool isErrorEnabled() const
Returns true if ERROR messages will be written to the log.
Definition: sag_plugin_logging.hpp:136
void crit(const char *format, ARGS... args) const
Log a message at CRIT level.
Definition: sag_plugin_logging.hpp:147
void debug(const std::string &format, ARGS... args) const
Log a message at DEBUG level.
Definition: sag_plugin_logging.hpp:172
void fatal(const std::string &format, ARGS... args) const
Log a message at FATAL level.
Definition: sag_plugin_logging.hpp:164
bool isFatalEnabled() const
Returns true if FATAL messages will be written to the log.
Definition: sag_plugin_logging.hpp:134
void crit(const std::string &format, ARGS... args) const
Log a message at CRIT level.
Definition: sag_plugin_logging.hpp:162
bool isDebugEnabled() const
Returns true if DEBUG messages will be written to the log.
Definition: sag_plugin_logging.hpp:142
void trace(const char *format, ARGS... args) const
Log a message at TRACE level.
Definition: sag_plugin_logging.hpp:159
void fatal(const char *format, ARGS... args) const
Log a message at FATAL level.
Definition: sag_plugin_logging.hpp:149
bool isInfoEnabled() const
Returns true if INFO messages will be written to the log.
Definition: sag_plugin_logging.hpp:140
Warnings.
Definition: sag_connectivity_c.h:90