mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 01:51:38 +08:00
moved pattern_formatter to details
This commit is contained in:
parent
001f57279e
commit
ef330729cb
@ -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" />
|
||||
|
@ -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>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
@ -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>;
|
||||
|
Loading…
Reference in New Issue
Block a user