mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 02:21:34 +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\log_msg.h" />
|
||||||
<ClInclude Include="..\..\include\c11log\details\null_mutex.h" />
|
<ClInclude Include="..\..\include\c11log\details\null_mutex.h" />
|
||||||
<ClInclude Include="..\..\include\c11log\details\os.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\details\stack_buf.h" />
|
||||||
<ClInclude Include="..\..\include\c11log\factory.h" />
|
<ClInclude Include="..\..\include\c11log\factory.h" />
|
||||||
<ClInclude Include="..\..\include\c11log\formatter.h" />
|
<ClInclude Include="..\..\include\c11log\formatter.h" />
|
||||||
<ClInclude Include="..\..\include\c11log\logger.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\async_sink.h" />
|
||||||
<ClInclude Include="..\..\include\c11log\sinks\base_sink.h" />
|
<ClInclude Include="..\..\include\c11log\sinks\base_sink.h" />
|
||||||
<ClInclude Include="..\..\include\c11log\sinks\ostream_sink.h" />
|
<ClInclude Include="..\..\include\c11log\sinks\ostream_sink.h" />
|
||||||
<ClInclude Include="..\..\include\c11log\sinks\file_sinks.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\null_sink.h" />
|
||||||
|
<ClInclude Include="..\..\include\c11log\sinks\sink.h" />
|
||||||
<ClInclude Include="..\..\include\c11log\sinks\stdout_sinks.h" />
|
<ClInclude Include="..\..\include\c11log\sinks\stdout_sinks.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="targetver.h" />
|
<ClInclude Include="targetver.h" />
|
||||||
|
@ -84,17 +84,17 @@
|
|||||||
<ClInclude Include="..\..\include\c11log\common.h">
|
<ClInclude Include="..\..\include\c11log\common.h">
|
||||||
<Filter>Header Files\c11log</Filter>
|
<Filter>Header Files\c11log</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\include\c11log\sinks\isink.h">
|
|
||||||
<Filter>Header Files\c11log\sinks</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\include\c11log\factory.h">
|
<ClInclude Include="..\..\include\c11log\factory.h">
|
||||||
<Filter>Header Files\c11log</Filter>
|
<Filter>Header Files\c11log</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\include\c11log\details\fast_istostr.h">
|
<ClInclude Include="..\..\include\c11log\details\fast_istostr.h">
|
||||||
<Filter>Header Files\c11log\details</Filter>
|
<Filter>Header Files\c11log\details</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\include\c11log\pattern_formatter.h">
|
<ClInclude Include="..\..\include\c11log\sinks\sink.h">
|
||||||
<Filter>Header Files\c11log</Filter>
|
<Filter>Header Files\c11log\sinks</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\include\c11log\details\pattern_formatter.h">
|
||||||
|
<Filter>Header Files\c11log\details</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -27,11 +27,11 @@ int main(int argc, char* argv[])
|
|||||||
cout_logger.info() << "Hello logger";
|
cout_logger.info() << "Hello logger";
|
||||||
|
|
||||||
auto nullsink = std::make_shared<sinks::null_sink<details::null_mutex>>();
|
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));
|
auto formatter2 = std::unique_ptr<formatter>(new pattern_formatter(pattern));
|
||||||
logger my_logger("my_logger", nullsink, std::move(formatter2));
|
logger my_logger("my_logger", rotating, std::move(formatter2));
|
||||||
//logger my_logger("my_logger", nullsink);
|
|
||||||
|
|
||||||
auto start = system_clock::now();
|
auto start = system_clock::now();
|
||||||
for (unsigned int i = 1; i <= howmany; ++i)
|
for (unsigned int i = 1; i <= howmany; ++i)
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "formatter.h"
|
#include "../formatter.h"
|
||||||
#include "details/log_msg.h"
|
#include "log_msg.h"
|
||||||
#include "details/fast_oss.h"
|
#include "fast_oss.h"
|
||||||
|
|
||||||
|
|
||||||
namespace c11log
|
namespace c11log
|
||||||
@ -163,7 +163,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::string _str;
|
std::string _str;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class pattern_formatter : public formatter
|
class pattern_formatter : public formatter
|
||||||
@ -180,16 +180,16 @@ private:
|
|||||||
void compile_pattern(const std::string& pattern);
|
void compile_pattern(const std::string& pattern);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline c11log::details::pattern_formatter::pattern_formatter(const std::string& pattern)
|
||||||
inline c11log::pattern_formatter::pattern_formatter(const std::string& pattern)
|
|
||||||
{
|
{
|
||||||
compile_pattern(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();
|
auto end = pattern.end();
|
||||||
for (auto it = pattern.begin(); it != end; ++it)
|
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)
|
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;
|
details::fast_oss oss;
|
||||||
for (auto &appender : _appenders)
|
for (auto &appender : _appenders)
|
@ -27,7 +27,7 @@ class line_logger;
|
|||||||
class logger
|
class logger
|
||||||
{
|
{
|
||||||
public:
|
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_vector_t = std::vector<sink_ptr>;
|
||||||
using sinks_init_list = std::initializer_list<sink_ptr>;
|
using sinks_init_list = std::initializer_list<sink_ptr>;
|
||||||
using formatter_ptr = std::unique_ptr<formatter>;
|
using formatter_ptr = std::unique_ptr<formatter>;
|
||||||
|
Loading…
Reference in New Issue
Block a user