15 #ifndef _SAG_PLUGIN_LOGGING_HPP_
16 #define _SAG_PLUGIN_LOGGING_HPP_
21 namespace softwareag {
22 namespace connectivity {
32 friend class CacheForThisThread;
53 class CacheForThisThread
57 CacheForThisThread(CacheOwner &owner);
59 ~CacheForThisThread();
79 Logger(
const std::string &category): category(
"AP_LOG_"+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;
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;
187 #include <sag_internal/logging.hpp>
189 #endif // _SAG_PLUGIN_LOGGING_HPP_
bool isDebugEnabled() const
Returns true if DEBUG messages will be written to the log.
Definition: sag_plugin_logging.hpp:142
void debug(const std::string &format, ARGS...args) const
Log a message at DEBUG level.
Definition: sag_plugin_logging.hpp:172
bool isInfoEnabled() const
Returns true if INFO messages will be written to the log.
Definition: sag_plugin_logging.hpp:140
Fatal errors.
Definition: sag_connectivity_c.h:81
void warn(const char *format, ARGS...args) const
Log a message at WARN level.
Definition: sag_plugin_logging.hpp:153
Class for writing to the system logger.
Definition: sag_plugin_logging.hpp:72
void error(const char *format, ARGS...args) const
Log a message at ERROR level.
Definition: sag_plugin_logging.hpp:151
Trace.
Definition: sag_connectivity_c.h:91
bool isTraceEnabled() const
Returns true if TRACE messages will be written to the log.
Definition: sag_plugin_logging.hpp:144
bool isErrorEnabled() const
Returns true if ERROR messages will be written to the log.
Definition: sag_plugin_logging.hpp:136
void warn(const std::string &format, ARGS...args) const
Log a message at WARN level.
Definition: sag_plugin_logging.hpp:168
sag_log_level_t level_t
The available log levels.
Definition: sag_plugin_logging.hpp:76
void crit(const std::string &format, ARGS...args) const
Log a message at CRIT level.
Definition: sag_plugin_logging.hpp:162
Debug messages.
Definition: sag_connectivity_c.h:89
Critical log messages.
Definition: sag_connectivity_c.h:79
Definition: sag_connectivity_threading.h:178
void info(const char *format, ARGS...args) const
Log a message at INFO level.
Definition: sag_plugin_logging.hpp:155
sag_log_level_t
Log levels for logging to the host log file.
Definition: sag_connectivity_c.h:76
Non-fatal errors.
Definition: sag_connectivity_c.h:83
void fatal(const char *format, ARGS...args) const
Log a message at FATAL level.
Definition: sag_plugin_logging.hpp:149
void error(const std::string &format, ARGS...args) const
Log a message at ERROR level.
Definition: sag_plugin_logging.hpp:166
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:87
bool isCritEnabled() const
Returns true if CRIT messages will be written to the log.
Definition: sag_plugin_logging.hpp:132
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 trace(const char *format, ARGS...args) const
Log a message at TRACE level.
Definition: sag_plugin_logging.hpp:159
void log(const char *format, ARGS...args) const
Log a message at a given level.
level_t getLevel() const
Returns the current log level.
Definition: sag_plugin_logging.hpp:127
void fatal(const std::string &format, ARGS...args) const
Log a message at FATAL level.
Definition: sag_plugin_logging.hpp:164
void crit(const char *format, ARGS...args) const
Log a message at CRIT level.
Definition: sag_plugin_logging.hpp:147
void debug(const char *format, ARGS...args) const
Log a message at DEBUG level.
Definition: sag_plugin_logging.hpp:157
void info(const std::string &format, ARGS...args) const
Log a message at INFO level.
Definition: sag_plugin_logging.hpp:170
bool isFatalEnabled() const
Returns true if FATAL messages will be written to the log.
Definition: sag_plugin_logging.hpp:134
void trace(const std::string &format, ARGS...args) const
Log a message at TRACE level.
Definition: sag_plugin_logging.hpp:174
bool isWarnEnabled() const
Returns true if WARN messages will be written to the log.
Definition: sag_plugin_logging.hpp:138
Warnings.
Definition: sag_connectivity_c.h:85