14 #ifndef _SAG_PLUGIN_LOGGING_HPP_ 15 #define _SAG_PLUGIN_LOGGING_HPP_ 20 namespace softwareag {
21 namespace _DATAT_INTERNAL_CPP_NAMESPACE {
31 friend class CacheForThisThread;
52 class CacheForThisThread
56 CacheForThisThread(CacheOwner &owner);
58 ~CacheForThisThread();
78 Logger(
const std::string &category): category(category), prefix(category), cachedLevel(getLevelImpl()) {}
86 template<level_t LEVEL,
typename... ARGS>
87 void log(
const char *format, ARGS... args)
const;
96 template<
typename... ARGS>
97 void log(level_t LEVEL,
const char *format, ARGS... args)
const;
105 template<level_t LEVEL,
typename... ARGS>
106 void log(
const std::string &format, ARGS... args)
const;
115 template<
typename... ARGS>
116 void log(level_t LEVEL,
const std::string &format, ARGS... args)
const;
122 return LEVEL <= getLevel();
146 template<
typename... ARGS>
void crit(
const char *format, ARGS... args)
const { log<SAG_LOG_CRIT>(format, args...); }
148 template<
typename... ARGS>
void fatal(
const char *format, ARGS... args)
const { log<SAG_LOG_FATAL>(format, args...); }
150 template<
typename... ARGS>
void error(
const char *format, ARGS... args)
const { log<SAG_LOG_ERROR>(format, args...); }
152 template<
typename... ARGS>
void warn(
const char *format, ARGS... args)
const { log<SAG_LOG_WARN>(format, args...); }
154 template<
typename... ARGS>
void info(
const char *format, ARGS... args)
const { log<SAG_LOG_INFO>(format, args...); }
156 template<
typename... ARGS>
void debug(
const char *format, ARGS... args)
const { log<SAG_LOG_DEBUG>(format, args...); }
158 template<
typename... ARGS>
void trace(
const char *format, ARGS... args)
const { log<SAG_LOG_TRACE>(format, args...); }
161 void crit(
const char *str)
const { log<SAG_LOG_CRIT>(
"%s", str); }
163 void fatal(
const char *str)
const { log<SAG_LOG_FATAL>(
"%s", str); }
165 void error(
const char *str)
const { log<SAG_LOG_ERROR>(
"%s", str); }
167 void warn(
const char *str)
const { log<SAG_LOG_WARN>(
"%s", str); }
169 void info(
const char *str)
const { log<SAG_LOG_INFO>(
"%s", str); }
171 void debug(
const char *str)
const { log<SAG_LOG_DEBUG>(
"%s", str); }
173 void trace(
const char *str)
const { log<SAG_LOG_TRACE>(
"%s", str); }
177 void crit(
const std::string &str)
const { log<SAG_LOG_CRIT>(
"%s", str.c_str()); }
179 void fatal(
const std::string &str)
const { log<SAG_LOG_FATAL>(
"%s", str.c_str()); }
181 void error(
const std::string &str)
const { log<SAG_LOG_ERROR>(
"%s", str.c_str()); }
183 void warn(
const std::string &str)
const { log<SAG_LOG_WARN>(
"%s", str.c_str()); }
185 void info(
const std::string &str)
const { log<SAG_LOG_INFO>(
"%s", str.c_str()); }
187 void debug(
const std::string &str)
const { log<SAG_LOG_DEBUG>(
"%s", str.c_str()); }
189 void trace(
const std::string &str)
const { log<SAG_LOG_TRACE>(
"%s", str.c_str()); }
192 template<
typename... ARGS>
void crit(
const std::string &format, ARGS... args)
const { log<SAG_LOG_CRIT>(format, args...); }
194 template<
typename... ARGS>
void fatal(
const std::string &format, ARGS... args)
const { log<SAG_LOG_FATAL>(format, args...); }
196 template<
typename... ARGS>
void error(
const std::string &format, ARGS... args)
const { log<SAG_LOG_ERROR>(format, args...); }
198 template<
typename... ARGS>
void warn(
const std::string &format, ARGS... args)
const { log<SAG_LOG_WARN>(format, args...); }
200 template<
typename... ARGS>
void info(
const std::string &format, ARGS... args)
const { log<SAG_LOG_INFO>(format, args...); }
202 template<
typename... ARGS>
void debug(
const std::string &format, ARGS... args)
const { log<SAG_LOG_DEBUG>(format, args...); }
204 template<
typename... ARGS>
void trace(
const std::string &format, ARGS... args)
const { log<SAG_LOG_TRACE>(format, args...); }
205 const std::string &getPrefix()
const {
return prefix; }
208 level_t getLevelImpl()
const;
209 std::string category;
216 namespace connectivity {
using namespace _DATAT_INTERNAL_CPP_NAMESPACE; }
221 #include <sag_internal/logging.hpp> 223 #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:120
void error(const std::string &str) const
Log a message at ERROR level without any arguments.
Definition: sag_plugin_logging.hpp:181
void warn(const std::string &format, ARGS... args) const
Log a message at WARN level.
Definition: sag_plugin_logging.hpp:198
void crit(const char *str) const
Log a message at CRIT level without any arguments.
Definition: sag_plugin_logging.hpp:161
Fatal errors.
Definition: sag_connectivity_c.h:85
Class for writing to the system logger.
Definition: sag_plugin_logging.hpp:71
bool isCritEnabled() const
Returns true if CRIT messages will be written to the log.
Definition: sag_plugin_logging.hpp:131
void debug(const char *format, ARGS... args) const
Log a message at DEBUG level.
Definition: sag_plugin_logging.hpp:156
Trace.
Definition: sag_connectivity_c.h:95
void error(const std::string &format, ARGS... args) const
Log a message at ERROR level.
Definition: sag_plugin_logging.hpp:196
void error(const char *format, ARGS... args) const
Log a message at ERROR level.
Definition: sag_plugin_logging.hpp:150
sag_log_level_t level_t
The available log levels.
Definition: sag_plugin_logging.hpp:75
bool isWarnEnabled() const
Returns true if WARN messages will be written to the log.
Definition: sag_plugin_logging.hpp:137
void info(const std::string &format, ARGS... args) const
Log a message at INFO level.
Definition: sag_plugin_logging.hpp:200
Debug messages.
Definition: sag_connectivity_c.h:93
Critical log messages.
Definition: sag_connectivity_c.h:83
void trace(const std::string &format, ARGS... args) const
Log a message at TRACE level.
Definition: sag_plugin_logging.hpp:204
level_t getLevel() const
Returns the current log level.
Definition: sag_plugin_logging.hpp:126
sag_log_level_t
Log levels for logging to the host log file.
Definition: sag_connectivity_c.h:80
Non-fatal errors.
Definition: sag_connectivity_c.h:87
void warn(const char *format, ARGS... args) const
Log a message at WARN level.
Definition: sag_plugin_logging.hpp:152
Logger(const std::string &category)
Construct a logger for the given category.
Definition: sag_plugin_logging.hpp:78
Informational messages (default)
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:143
void fatal(const std::string &str) const
Log a message at FATAL level without any arguments.
Definition: sag_plugin_logging.hpp:179
void warn(const std::string &str) const
Log a message at WARN level without any arguments.
Definition: sag_plugin_logging.hpp:183
void info(const char *format, ARGS... args) const
Log a message at INFO level.
Definition: sag_plugin_logging.hpp:154
bool isErrorEnabled() const
Returns true if ERROR messages will be written to the log.
Definition: sag_plugin_logging.hpp:135
void crit(const char *format, ARGS... args) const
Log a message at CRIT level.
Definition: sag_plugin_logging.hpp:146
void debug(const std::string &format, ARGS... args) const
Log a message at DEBUG level.
Definition: sag_plugin_logging.hpp:202
void trace(const std::string &str) const
Log a message at TRACE level without any arguments.
Definition: sag_plugin_logging.hpp:189
void fatal(const std::string &format, ARGS... args) const
Log a message at FATAL level.
Definition: sag_plugin_logging.hpp:194
void error(const char *str) const
Log a message at ERROR level without any arguments.
Definition: sag_plugin_logging.hpp:165
void warn(const char *str) const
Log a message at WARN level without any arguments.
Definition: sag_plugin_logging.hpp:167
bool isFatalEnabled() const
Returns true if FATAL messages will be written to the log.
Definition: sag_plugin_logging.hpp:133
void crit(const std::string &format, ARGS... args) const
Log a message at CRIT level.
Definition: sag_plugin_logging.hpp:192
void info(const std::string &str) const
Log a message at INFO level without any arguments.
Definition: sag_plugin_logging.hpp:185
void debug(const char *str) const
Log a message at DEBUG level without any arguments.
Definition: sag_plugin_logging.hpp:171
void fatal(const char *str) const
Log a message at FATAL level without any arguments.
Definition: sag_plugin_logging.hpp:163
void info(const char *str) const
Log a message at INFO level without any arguments.
Definition: sag_plugin_logging.hpp:169
void crit(const std::string &str) const
Log a message at CRIT level without any arguments.
Definition: sag_plugin_logging.hpp:177
bool isDebugEnabled() const
Returns true if DEBUG messages will be written to the log.
Definition: sag_plugin_logging.hpp:141
void trace(const char *format, ARGS... args) const
Log a message at TRACE level.
Definition: sag_plugin_logging.hpp:158
void debug(const std::string &str) const
Log a message at DEBUG level without any arguments.
Definition: sag_plugin_logging.hpp:187
void trace(const char *str) const
Log a message at TRACE level without any arguments.
Definition: sag_plugin_logging.hpp:173
void fatal(const char *format, ARGS... args) const
Log a message at FATAL level.
Definition: sag_plugin_logging.hpp:148
bool isInfoEnabled() const
Returns true if INFO messages will be written to the log.
Definition: sag_plugin_logging.hpp:139
Warnings.
Definition: sag_connectivity_c.h:89