// return the string DEBUG, else return the empty string.
LoggerLevelImpl::LogLevelString
LoggerLevelImpl::logLevelToString(log4cplus::LogLevel level) {
- static const tstring debug_string("DEBUG");
- static const tstring empty_string;
Level bindlevel = convertToBindLevel(level);
Severity& severity = bindlevel.severity;
int& dbglevel = bindlevel.dbglevel;
if ((severity == DEBUG) &&
((dbglevel >= MIN_DEBUG_LEVEL) && (dbglevel <= MAX_DEBUG_LEVEL))) {
- return (debug_string);
+ return (tstring("DEBUG"));
}
// Unknown, so return empty string for log4cplus to try other conversion
// functions.
- return (empty_string);
+ return (tstring());
}
// Initialization. Register the conversion functions with the LogLevelManager.
class LoggerLevelImpl {
public:
-#if (LOG4CPLUS_VERSION >= LOG4CPLUS_MAKE_VERSION(1, 1, 0))
- typedef log4cplus::tstring const & LogLevelString;
-#else
- typedef log4cplus::tstring LogLevelString;
-#endif
+typedef log4cplus::tstring LogLevelString;
/// \brief Convert Kea level to log4cplus logging level
///
namespace isc {
namespace log {
+// Constructor
+
+MessageDictionary::MessageDictionary() : dictionary_(), empty_("") {
+}
+
// (Virtual) Destructor
MessageDictionary::~MessageDictionary() {
const string&
MessageDictionary::getText(const std::string& ident) const {
- static const string empty("");
Dictionary::const_iterator i = dictionary_.find(ident);
if (i == dictionary_.end()) {
- return (empty);
+ return (empty_);
}
else {
return (i->second);
typedef std::map<std::string, std::string> Dictionary;
typedef Dictionary::const_iterator const_iterator;
- // Default constructor and assignment operator are OK for this class
+ /// \brief Constructor
+ MessageDictionary();
/// \brief Virtual Destructor
virtual ~MessageDictionary();
private:
Dictionary dictionary_; ///< Holds the ID to text lookups
+ const std::string empty_; ///< Empty string
};
} // namespace log