Commit e6586db0 authored by Francis Dupont's avatar Francis Dupont

[3513] added static getVersion for log

parent c817b5d1
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -50,6 +50,12 @@ Logger::~Logger() {
loggerptr_ = 0;
}
// Get Version
std::string
Logger::getVersion() {
return (LoggerImpl::getVersion());
}
// Get Name of Logger
std::string
......
// Copyright (C) 2011, 2014 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -200,6 +200,9 @@ public:
/// \brief Destructor
virtual ~Logger();
/// \brief Version
static std::string getVersion();
/// \brief The formatter used to replace placeholders
typedef isc::log::Formatter<Logger> Formatter;
......
// Copyright (C) 2011,2014-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011, 2014-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -19,10 +19,12 @@
#include <stdarg.h>
#include <stdio.h>
#include <cstring>
#include <sstream>
#include <boost/lexical_cast.hpp>
#include <boost/static_assert.hpp>
#include <boost/algorithm/string.hpp>
#include <log4cplus/version.h>
#include <log4cplus/configurator.h>
#include <log4cplus/loggingmacros.h>
......@@ -84,6 +86,15 @@ LoggerImpl::~LoggerImpl() {
delete sync_;
}
/// \brief Version
std::string
LoggerImpl::getVersion() {
std::ostringstream ver;
ver << "log4plus ";
ver << log4cplus::versionStr;
return (ver.str());
}
// Set the severity for logging.
void
LoggerImpl::setSeverity(isc::log::Severity severity, int dbglevel) {
......
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -77,6 +77,10 @@ public:
virtual ~LoggerImpl();
/// \brief Version
static std::string getVersion();
/// \brief Get the full name of the logger (including the root name)
virtual std::string getName() {
return (name_);
......
......@@ -48,6 +48,11 @@ public:
}
};
// Check version
TEST_F(LoggerTest, Version) {
EXPECT_NO_THROW(Logger::getVersion());
}
// Checks that the logger is named correctly.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment