mirror of https://github.com/gabime/spdlog.git
Udpated example and spdlog.h
parent
0969118ce7
commit
e4d3eb64e6
@ -1,12 +0,0 @@
|
||||
//
|
||||
// Copyright(c) 2015 Gabi Melman.
|
||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "wincolor_sink.h"
|
||||
#else
|
||||
#include "ansicolor_sink.h"
|
||||
#endif
|
||||
|
@ -0,0 +1,55 @@
|
||||
//
|
||||
// Copyright(c) 2018 spdlog
|
||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../spdlog.h"
|
||||
#ifdef _WIN32
|
||||
#include "wincolor_sink.h"
|
||||
#else
|
||||
#include "ansicolor_sink.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
using namespace spdlog::sinks;
|
||||
#ifdef _WIN32
|
||||
using stdout_color_sink_mt = wincolor_stdout_sink_mt;
|
||||
using stdout_color_sink_st = wincolor_stdout_sink_st;
|
||||
using stderr_color_sink_mt = wincolor_stderr_sink_mt;
|
||||
using stderr_color_sink_st = wincolor_stderr_sink_st;
|
||||
#else
|
||||
using stdout_color_sink_mt = ansicolor_stdout_sink_mt;
|
||||
using stdout_color_sink_st = ansicolor_stdout_sink_st;
|
||||
using stderr_color_sink_mt = ansicolor_stderr_sink_mt;
|
||||
using stderr_color_sink_st = ansicolor_stderr_sink_st;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace spdlog
|
||||
{
|
||||
template<typename Factory = default_factory>
|
||||
inline std::shared_ptr<logger> stdout_color_mt(const std::string &logger_name)
|
||||
{
|
||||
return Factory::template create<stdout_color_sink_mt>(logger_name);
|
||||
}
|
||||
template<typename Factory = default_factory>
|
||||
inline std::shared_ptr<logger> stdout_color_st(const std::string &logger_name)
|
||||
{
|
||||
return Factory::template create<stdout_color_sink_st>(logger_name);
|
||||
}
|
||||
|
||||
template<typename Factory = default_factory>
|
||||
inline std::shared_ptr<logger> stderr_color_mt(const std::string &logger_name)
|
||||
{
|
||||
return Factory::template create<stderr_color_sink_mt>(logger_name);
|
||||
}
|
||||
|
||||
template<typename Factory = default_factory>
|
||||
inline std::shared_ptr<logger> stderr_color_st(const std::string &logger_name)
|
||||
{
|
||||
return Factory::template createstderr_color_sink_mt>(logger_name);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue