1 #ifndef _GEMFIRE_LOG_HPP_ 2 #define _GEMFIRE_LOG_HPP_ 19 #include "gfcpp_globals.hpp" 26 #ifndef GEMFIRE_HIGHEST_LOG_LEVEL 27 #define GEMFIRE_HIGHEST_LOG_LEVEL All 31 #ifndef GEMFIRE_MAX_LOG_FILE_LIMIT 32 #define GEMFIRE_MAX_LOG_FILE_LIMIT (1024 * 1024 * 1024) 35 #ifndef GEMFIRE_MAX_LOG_DISK_LIMIT 36 #define GEMFIRE_MAX_LOG_DISK_LIMIT (1024ll * 1024ll * 1024ll * 1024ll) 39 #define _GF_MSG_LIMIT 8192 54 #define GF_LOG(level,expr) if ( level > gemfire::Log::logLevel() ) { } else gemfire::Log::log(level, expr) 176 {
return s_logLevel; }
182 { s_logLevel = level; }
189 static const char* logFileName();
200 (LogLevel level,
const char* logFileName,
int32 logFileLimit = 0,
int64 logDiskSpaceLimit = 0);
215 static const char* levelToChars(Log::LogLevel level);
223 static LogLevel charsToLevel(
const char* chars);
240 static char* formatLogLine(
char* buf, LogLevel level);
251 (((s_doingDebug && level == Debug) ||
259 static void log(LogLevel level,
const char* msg)
272 putThrow(level, msg, ex);
282 putCatch(level, msg, ex);
316 putThrow(Error, msg, ex);
326 putCatch(Error, msg, ex);
348 if (warningEnabled())
359 if (warningEnabled())
360 putThrow(Warning, msg, ex);
370 if (warningEnabled())
371 putCatch(Warning, msg, ex);
391 static void info(
const char* msg)
405 putThrow(Info, msg, ex);
416 putCatch(Info, msg, ex);
450 putThrow(Config, msg, ex);
461 putCatch(Config, msg, ex);
481 static void fine(
const char* msg)
495 putThrow(Fine, msg, ex);
506 putCatch(Fine, msg, ex);
540 putThrow(Finer, msg, ex);
551 putCatch(Finer, msg, ex);
585 putThrow(Finest, msg, ex);
596 putCatch(Finest, msg, ex);
631 putThrow(Debug, msg, ex);
642 putCatch(Debug, msg, ex);
649 static void enterFn(LogLevel level,
const char* functionName);
652 static void exitFn(LogLevel level,
const char* functionName);
661 static LogLevel s_logLevel;
667 enum { s_doingDebug = 1 };
669 enum { s_doingDebug = 0 };
676 static void writeBanner();
682 static void put(LogLevel level,
const char* msg);
685 (LogLevel level,
const char* msg,
const Exception& ex);
688 (LogLevel level,
const char* msg,
const Exception& ex);
699 const char* m_functionName;
700 Log::LogLevel m_level;
704 LogFn(
const char* functionName, Log::LogLevel level = Log::Finest)
705 : m_functionName(functionName), m_level(level)
708 Log::enterFn(m_level, m_functionName);
714 Log::exitFn(m_level, m_functionName);
718 LogFn(
const LogFn& rhs);
719 void operator = (
const LogFn& rhs);
733 static void debug(
const char* fmt, ...);
734 static void error(
const char* fmt, ...);
735 static void warn(
const char* fmt, ...);
736 static void info(
const char* fmt, ...);
737 static void config(
const char* fmt, ...);
738 static void fine(
const char* fmt, ...);
739 static void finer(
const char* fmt, ...);
740 static void finest(
const char* fmt, ...);
748 #define LOGDEBUG if ( gemfire::Log::Debug <= gemfire::Log::logLevel() ) gemfire::LogVarargs::debug 752 #define LOGERROR if ( gemfire::Log::Error <= gemfire::Log::logLevel() ) gemfire::LogVarargs::error 756 #define LOGWARN if ( gemfire::Log::Warning <= gemfire::Log::logLevel() ) gemfire::LogVarargs::warn 760 #define LOGINFO if ( gemfire::Log::Info <= gemfire::Log::logLevel() ) gemfire::LogVarargs::info 764 #define LOGCONFIG if ( gemfire::Log::Config <= gemfire::Log::logLevel() ) gemfire::LogVarargs::config 768 #define LOGFINE if ( gemfire::Log::Fine <= gemfire::Log::logLevel() ) gemfire::LogVarargs::fine 772 #define LOGFINER if ( gemfire::Log::Finer <= gemfire::Log::logLevel() ) gemfire::LogVarargs::finer 776 #define LOGFINEST if ( gemfire::Log::Finest <= gemfire::Log::logLevel() ) gemfire::LogVarargs::finest static bool finerEnabled()
Returns whether "finer" log messages are enabled.
Definition: Log.hpp:516
static void finerThrow(const char *msg, const Exception &ex)
Logs both a message and thrown exception.
Definition: Log.hpp:537
static void setLogLevel(LogLevel level)
Set the current log level.
Definition: Log.hpp:181
#define GEMFIRE_HIGHEST_LOG_LEVEL
The interface of the Log class.
Definition: Log.hpp:27
static void info(const char *msg)
Logs a message.
Definition: Log.hpp:391
static void configThrow(const char *msg, const Exception &ex)
Logs both a message and thrown exception.
Definition: Log.hpp:447
static bool configEnabled()
Returns whether "config" log messages are enabled.
Definition: Log.hpp:426
int64_t int64
signed 64 bit integer
Definition: gf_base.hpp:180
static void finestThrow(const char *msg, const Exception &ex)
Logs both a message and thrown exception.
Definition: Log.hpp:582
These functions are added to facilitate logging in printf format.
Definition: Log.hpp:729
static void debugThrow(const char *msg, const Exception &ex)
Logs both a message and thrown exception.
Definition: Log.hpp:628
static void log(LogLevel level, const char *msg)
Logs a message at given level.
Definition: Log.hpp:259
static void configCatch(const char *msg, const Exception &ex)
Writes both a message and caught exception.
Definition: Log.hpp:458
static void warningThrow(const char *msg, const Exception &ex)
Logs both a message and thrown exception.
Definition: Log.hpp:357
static void finer(const char *msg)
Logs a message.
Definition: Log.hpp:526
static bool enabled(LogLevel level)
Returns whether log messages at given level are enabled.
Definition: Log.hpp:248
static void fineCatch(const char *msg, const Exception &ex)
Writes both a message and caught exception.
Definition: Log.hpp:503
static void infoThrow(const char *msg, const Exception &ex)
Logs both a message and thrown exception.
Definition: Log.hpp:402
static LogLevel logLevel()
Returns the current log level.
Definition: Log.hpp:175
static bool errorEnabled()
Returns whether "error" log messages are enabled.
Definition: Log.hpp:292
static void errorThrow(const char *msg, const Exception &ex)
Logs both a message and thrown exception.
Definition: Log.hpp:313
This namespace contains all the GemFire C++ API classes, enumerations and globals.
Definition: Assert.hpp:19
static bool warningEnabled()
Returns whether "warning" log messages are enabled.
Definition: Log.hpp:336
static bool finestEnabled()
Returns whether "finest" log messages are enabled.
Definition: Log.hpp:561
static void debug(const char *msg)
Logs a message.
Definition: Log.hpp:617
static void finestCatch(const char *msg, const Exception &ex)
Writes both a message and caught exception.
Definition: Log.hpp:593
static void logThrow(LogLevel level, const char *msg, const Exception &ex)
Logs both a message and thrown exception.
Definition: Log.hpp:269
int32_t int32
signed 32 bit integer
Definition: gf_base.hpp:178
static void logCatch(LogLevel level, const char *msg, const Exception &ex)
Logs both a message and caught exception.
Definition: Log.hpp:279
static void error(const char *msg)
Logs a message.
Definition: Log.hpp:302
static void warningCatch(const char *msg, const Exception &ex)
Writes both a message and caught exception.
Definition: Log.hpp:368
static void infoCatch(const char *msg, const Exception &ex)
Writes both a message and caught exception.
Definition: Log.hpp:413
static bool fineEnabled()
Returns whether "fine" log messages are enabled.
Definition: Log.hpp:471
#define CPPCACHE_EXPORT
Defines a GemFire CPPCACHE export.
Definition: gf_base.hpp:51
static bool debugEnabled()
Returns whether "debug" log messages are enabled.
Definition: Log.hpp:606
A description of an exception that occurred during a cache operation.
Definition: Exception.hpp:31
static void debugCatch(const char *msg, const Exception &ex)
Writes both a message and caught exception.
Definition: Log.hpp:639
static bool infoEnabled()
Returns whether "info" log messages are enabled.
Definition: Log.hpp:381
static void fineThrow(const char *msg, const Exception &ex)
Logs both a message and thrown exception.
Definition: Log.hpp:492
static void finerCatch(const char *msg, const Exception &ex)
Writes both a message and caught exception.
Definition: Log.hpp:548
static void config(const char *msg)
Logs a message.
Definition: Log.hpp:436
static void errorCatch(const char *msg, const Exception &ex)
Writes both a message and caught exception.
Definition: Log.hpp:323
static void fine(const char *msg)
Logs a message.
Definition: Log.hpp:481
static void warning(const char *msg)
Logs a message.
Definition: Log.hpp:346
static void finest(const char *msg)
Logs a message.
Definition: Log.hpp:571
Defines methods available to clients that want to write a log message to their GemFire system's share...
Definition: Log.hpp:135