moved pattern_formatter to details

This commit is contained in:
gabi 2014-10-14 04:29:52 +03:00
parent 001f57279e
commit ef330729cb
5 changed files with 21 additions and 21 deletions

View File

@ -94,17 +94,17 @@
<ClInclude Include="..\..\include\c11log\details\log_msg.h" />
<ClInclude Include="..\..\include\c11log\details\null_mutex.h" />
<ClInclude Include="..\..\include\c11log\details\os.h" />
<ClInclude Include="..\..\include\c11log\details\pattern_formatter.h" />
<ClInclude Include="..\..\include\c11log\details\stack_buf.h" />
<ClInclude Include="..\..\include\c11log\factory.h" />
<ClInclude Include="..\..\include\c11log\formatter.h" />
<ClInclude Include="..\..\include\c11log\logger.h" />
<ClInclude Include="..\..\include\c11log\pattern_formatter.h" />
<ClInclude Include="..\..\include\c11log\sinks\async_sink.h" />
<ClInclude Include="..\..\include\c11log\sinks\base_sink.h" />
<ClInclude Include="..\..\include\c11log\sinks\ostream_sink.h" />
<ClInclude Include="..\..\include\c11log\sinks\file_sinks.h" />
<ClInclude Include="..\..\include\c11log\sinks\isink.h" />
<ClInclude Include="..\..\include\c11log\sinks\null_sink.h" />
<ClInclude Include="..\..\include\c11log\sinks\sink.h" />
<ClInclude Include="..\..\include\c11log\sinks\stdout_sinks.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />

View File

@ -84,17 +84,17 @@
<ClInclude Include="..\..\include\c11log\common.h">
<Filter>Header Files\c11log</Filter>
</ClInclude>
<ClInclude Include="..\..\include\c11log\sinks\isink.h">
<Filter>Header Files\c11log\sinks</Filter>
</ClInclude>
<ClInclude Include="..\..\include\c11log\factory.h">
<Filter>Header Files\c11log</Filter>
</ClInclude>
<ClInclude Include="..\..\include\c11log\details\fast_istostr.h">
<Filter>Header Files\c11log\details</Filter>
</ClInclude>
<ClInclude Include="..\..\include\c11log\pattern_formatter.h">
<Filter>Header Files\c11log</Filter>
<ClInclude Include="..\..\include\c11log\sinks\sink.h">
<Filter>Header Files\c11log\sinks</Filter>
</ClInclude>
<ClInclude Include="..\..\include\c11log\details\pattern_formatter.h">
<Filter>Header Files\c11log\details</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>

View File

@ -27,11 +27,11 @@ int main(int argc, char* argv[])
cout_logger.info() << "Hello logger";
auto nullsink = std::make_shared<sinks::null_sink<details::null_mutex>>();
auto rotating = std::make_shared<sinks::rotating_file_sink_mt>("myrotating", "txt", 1024 * 1024 * 5, 5, 100);
auto formatter2 = std::unique_ptr<formatter>(new pattern_formatter(pattern));
logger my_logger("my_logger", nullsink, std::move(formatter2));
//logger my_logger("my_logger", nullsink);
logger my_logger("my_logger", rotating, std::move(formatter2));
auto start = system_clock::now();
for (unsigned int i = 1; i <= howmany; ++i)

View File

@ -5,9 +5,9 @@
#include <memory>
#include <vector>
#include "formatter.h"
#include "details/log_msg.h"
#include "details/fast_oss.h"
#include "../formatter.h"
#include "log_msg.h"
#include "fast_oss.h"
namespace c11log
@ -46,7 +46,7 @@ class Y_appender :public pattern_appender
{
void append(const details::log_msg& msg, details::fast_oss& oss) override
{
oss.put_int(msg.tm_time.tm_year+1900, 4);
oss.put_int(msg.tm_time.tm_year + 1900, 4);
}
};
@ -140,7 +140,7 @@ public:
{}
void append(const details::log_msg& msg, details::fast_oss& oss) override
{
oss.putc( _ch);
oss.putc(_ch);
}
private:
char _ch;
@ -163,7 +163,7 @@ public:
private:
std::string _str;
};
}
class pattern_formatter : public formatter
@ -180,16 +180,16 @@ private:
void compile_pattern(const std::string& pattern);
};
}
}
inline c11log::pattern_formatter::pattern_formatter(const std::string& pattern)
inline c11log::details::pattern_formatter::pattern_formatter(const std::string& pattern)
{
compile_pattern(pattern);
}
inline void c11log::pattern_formatter::compile_pattern(const std::string& pattern)
inline void c11log::details::pattern_formatter::compile_pattern(const std::string& pattern)
{
auto end = pattern.end();
for (auto it = pattern.begin(); it != end; ++it)
@ -209,7 +209,7 @@ inline void c11log::pattern_formatter::compile_pattern(const std::string& patter
}
}
inline void c11log::pattern_formatter::handle_flag(char flag)
inline void c11log::details::pattern_formatter::handle_flag(char flag)
{
switch (flag)
{
@ -271,7 +271,7 @@ inline void c11log::pattern_formatter::handle_flag(char flag)
}
inline void c11log::pattern_formatter::format(details::log_msg& msg)
inline void c11log::details::pattern_formatter::format(details::log_msg& msg)
{
details::fast_oss oss;
for (auto &appender : _appenders)

View File

@ -27,7 +27,7 @@ class line_logger;
class logger
{
public:
using sink_ptr = std::shared_ptr<sinks::isink>;
using sink_ptr = std::shared_ptr<sinks::sink>;
using sinks_vector_t = std::vector<sink_ptr>;
using sinks_init_list = std::initializer_list<sink_ptr>;
using formatter_ptr = std::unique_ptr<formatter>;