spdlog/spdlite/example/create_logger.cpp

17 lines
455 B
C++
Raw Normal View History

2019-03-30 19:53:02 +08:00
// Copyright(c) 2015-present Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
2019-03-30 21:49:02 +08:00
#include "spdlite/spdlite.h"
2019-03-23 19:31:57 +08:00
#include "spdlog/spdlog.h"
2019-03-24 01:34:50 +08:00
#include "spdlog/sinks/basic_file_sink.h"
2019-03-30 19:53:02 +08:00
2019-03-24 01:34:50 +08:00
2019-03-24 07:18:05 +08:00
#define UNUSED(x) (void)(x)
// example of creating lite logger with console and file sink
2019-03-30 18:49:54 +08:00
spdlite::logger create_logger(void *ctx)
2019-03-23 19:31:57 +08:00
{
2019-03-24 07:18:05 +08:00
UNUSED(ctx);
2019-03-30 19:53:02 +08:00
return spdlite::logger(spdlog::basic_logger_mt("logger-name", "log.txt", true));
2019-03-23 19:31:57 +08:00
}