summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project2/common/logger.cpp7
-rw-r--r--project2/common/logger.h3
2 files changed, 9 insertions, 1 deletions
diff --git a/project2/common/logger.cpp b/project2/common/logger.cpp
index 95c2b15..98aaf0b 100644
--- a/project2/common/logger.cpp
+++ b/project2/common/logger.cpp
@@ -81,6 +81,13 @@ Log::vmessagef(int priority, const char * msgfmt, va_list va) const
free(msg);
}
+
+boost::shared_ptr<boost::format>
+Log::getFormat(const std::string & msgfmt)
+{
+ return AdHoc::Buffer::getFormat(msgfmt);
+}
+
Log *
Logger::operator->() const
{
diff --git a/project2/common/logger.h b/project2/common/logger.h
index d472ac6..0a6398e 100644
--- a/project2/common/logger.h
+++ b/project2/common/logger.h
@@ -40,7 +40,7 @@ class Log {
template <typename... Args>
void messagebf(int priority, const char * msgfmt, const Args & ... args) const {
if (priority > lowestLevel) return;
- boost::shared_ptr<boost::format> fmt = AdHoc::Buffer::getFormat(msgfmt);
+ boost::shared_ptr<boost::format> fmt = getFormat(msgfmt);
messagebf(priority, *fmt, args...);
}
void vmessagef(int priority, const char * msgfmt, va_list) const;
@@ -54,6 +54,7 @@ class Log {
messagebf(priority, f, otherargs...);
}
void messagebf(int priority, const boost::format & f) const;
+ static boost::shared_ptr<boost::format> getFormat(const std::string & msgfmt);
LogDrivers logs;
int lowestLevel;
int nextId;