Some syntactic improvements

This commit is contained in:
gabi 2014-10-10 21:32:10 +03:00
parent b49b086723
commit 068a0e3a6b
2 changed files with 9 additions and 13 deletions

View File

@ -6,12 +6,11 @@
#include "fast_oss.h"
// line_logger class.
// aggregates single log line (on the stack if possibe) and calls the logger upon destruction
// Line logger class - aggregates operator<< calls to fast ostream
// and logs upon destruction
namespace c11log
{
namespace details
{
class line_logger

View File

@ -29,7 +29,7 @@ public:
using sink_ptr = std::shared_ptr<sinks::isink>;
using sinks_vector_t = std::vector<sink_ptr>;
using sinks_init_list = std::initializer_list<sink_ptr>;
using formatter_ptr = std::unique_ptr<c11log::formatters::formatter>;
using formatter_ptr = std::unique_ptr<formatters::formatter>;
logger(const std::string& name, sinks_init_list, formatter_ptr = nullptr);
logger(const std::string& name, sink_ptr, formatter_ptr = nullptr);
@ -37,12 +37,11 @@ public:
logger& operator=(const logger&) = delete;
~logger() = default;
void level(c11log::level::level_enum);
c11log::level::level_enum level() const;
void level(level::level_enum);
level::level_enum level() const;
const std::string& name() const;
bool should_log(c11log::level::level_enum) const;
bool should_log(level::level_enum) const;
template<typename T> details::line_logger trace(const T&);
template<typename T> details::line_logger debug(const T&);
@ -60,11 +59,9 @@ public:
details::line_logger critical();
details::line_logger fatal();
private:
friend details::line_logger;
std::string _logger_name;
std::string _name;
formatter_ptr _formatter;
sinks_vector_t _sinks;
std::atomic_int _level;
@ -97,7 +94,7 @@ inline std::shared_ptr<c11log::logger> c11log::get_logger(const std::string& nam
inline c11log::logger::logger(const std::string& name, sinks_init_list sinks_list, formatter_ptr f) :
_logger_name(name),
_name(name),
_formatter(std::move(f)),
_sinks(sinks_list)
{
@ -195,7 +192,7 @@ inline c11log::details::line_logger c11log::logger::fatal()
inline const std::string& c11log::logger::name() const
{
return _logger_name;
return _name;
}
inline void c11log::logger::level(c11log::level::level_enum level)