summaryrefslogtreecommitdiff
path: root/ndb/include/logger
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2004-12-22 22:47:56 +0100
committerunknown <tomas@poseidon.ndb.mysql.com>2004-12-22 22:47:56 +0100
commit7b0857a7d050a58c53c6b8ad6b2848959e9d5ce6 (patch)
treec9f54c8da5d70c1b4be2d24b38c3c966732371cd /ndb/include/logger
parenteebd8d7e41fbfc954b567ac6561a5b3b617a232e (diff)
downloadmariadb-git-7b0857a7d050a58c53c6b8ad6b2848959e9d5ce6.tar.gz
fixed so that last repeats are printed first with correct time if another message comes
decided for fixed size buffers in LogHandler repeated messages mysql-test/ndb/basic.result: updated ndb test ndb/include/logger/LogHandler.hpp: decided for fixed size buffers ndb/include/logger/Logger.hpp: decided for fixed size buffers ndb/src/common/logger/LogHandler.cpp: decided for fixed size buffers ndb/src/common/logger/Logger.cpp: decided for fixed size buffers
Diffstat (limited to 'ndb/include/logger')
-rw-r--r--ndb/include/logger/LogHandler.hpp29
-rw-r--r--ndb/include/logger/Logger.hpp2
2 files changed, 17 insertions, 14 deletions
diff --git a/ndb/include/logger/LogHandler.hpp b/ndb/include/logger/LogHandler.hpp
index 57169e7ae6a..7df6ad864e5 100644
--- a/ndb/include/logger/LogHandler.hpp
+++ b/ndb/include/logger/LogHandler.hpp
@@ -19,7 +19,6 @@
#include "Logger.hpp"
-
/**
* This class is the base class for all log handlers. A log handler is
* responsible for formatting and writing log messages to a specific output.
@@ -68,7 +67,8 @@ public:
/**
* Append a log message to the output stream/file whatever.
* append() will call writeHeader(), writeMessage() and writeFooter() for
- * a child class and in that order.
+ * a child class and in that order. Append checks for repeated messages.
+ * append_impl() does not check for repeats.
*
* @param pCategory the category/name to tag the log entry with.
* @param level the log level.
@@ -76,6 +76,8 @@ public:
*/
void append(const char* pCategory, Logger::LoggerLevel level,
const char* pMsg);
+ void append_impl(const char* pCategory, Logger::LoggerLevel level,
+ const char* pMsg);
/**
* Returns a default formatted header. It currently has the
@@ -112,14 +114,6 @@ public:
void setDateTimeFormat(const char* pFormat);
/**
- * Returns a string date and time string.
- *
- * @param pStr a string.
- * @return a string with date and time.
- */
- char* getTimeAsString(char* pStr) const;
-
- /**
* Returns the error code.
*/
int getErrorCode() const;
@@ -185,6 +179,15 @@ protected:
virtual void writeFooter() = 0;
private:
+ /**
+ * Returns a string date and time string.
+ * @note does not update time, uses m_now as time
+ * @param pStr a string.
+ * @return a string with date and time.
+ */
+ char* getTimeAsString(char* pStr) const;
+ time_t m_now;
+
/** Prohibit */
LogHandler(const LogHandler&);
LogHandler* operator = (const LogHandler&);
@@ -197,11 +200,9 @@ private:
unsigned m_count_repeated_messages;
unsigned m_max_repeat_frequency;
time_t m_last_log_time;
- char m_last_category_buf[16];
- char m_last_message_buf[256];
- char *m_last_category;
+ char m_last_category[MAX_HEADER_LENGTH];
+ char m_last_message[MAX_LOG_MESSAGE_SIZE];
Logger::LoggerLevel m_last_level;
- char *m_last_message;
};
#endif
diff --git a/ndb/include/logger/Logger.hpp b/ndb/include/logger/Logger.hpp
index f12297023b7..ee762098fb6 100644
--- a/ndb/include/logger/Logger.hpp
+++ b/ndb/include/logger/Logger.hpp
@@ -20,6 +20,8 @@
#include <ndb_global.h>
#include <BaseString.hpp>
+#define MAX_LOG_MESSAGE_SIZE 1024
+
class LogHandler;
class LogHandlerList;