From 3d241a1cf199a7ae2213cbec5e1ccf5753905276 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 3 Sep 2015 01:06:44 +0100 Subject: Wrap getFormat so clients don't need to link against libadhocutil just to use messagebf --- project2/common/logger.cpp | 7 +++++++ project2/common/logger.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 +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 void messagebf(int priority, const char * msgfmt, const Args & ... args) const { if (priority > lowestLevel) return; - boost::shared_ptr fmt = AdHoc::Buffer::getFormat(msgfmt); + boost::shared_ptr 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 getFormat(const std::string & msgfmt); LogDrivers logs; int lowestLevel; int nextId; -- cgit v1.2.3