spdlog/lite-example/create_lite.cpp

20 lines
538 B
C++
Raw Normal View History

2019-03-23 11:25:50 -04:00
#include "spdlite.h"
2019-03-23 07:31:57 -04:00
#include "spdlog/spdlog.h"
2019-03-23 13:34:50 -04:00
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"
2019-03-23 07:31:57 -04:00
2019-03-23 10:39:32 -04:00
spdlog::lite::logger spdlog::create_lite(void *ctx)
2019-03-23 07:31:57 -04:00
{
2019-03-23 10:39:32 -04:00
if (ctx)
{
2019-03-23 07:31:57 -04:00
//..
}
2019-03-23 13:34:50 -04:00
auto logger_impl = spdlog::stdout_color_mt("mylogger");
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>("file.txt", true);
logger_impl->sinks().push_back(file_sink);
logger_impl->set_level(spdlog::level::debug);
return spdlog::lite::logger(std::move(logger_impl));
2019-03-23 07:31:57 -04:00
}