mirror of
https://github.com/gabime/spdlog.git
synced 2025-04-01 02:42:41 +08:00
astyle
This commit is contained in:
parent
0cfdad4d0b
commit
f14d1c002b
@ -14,14 +14,14 @@
|
|||||||
|
|
||||||
namespace spdlog
|
namespace spdlog
|
||||||
{
|
{
|
||||||
namespace sinks
|
namespace sinks
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class Mutex>
|
template <class Mutex>
|
||||||
class stdout_sink: public base_sink<Mutex>
|
class stdout_sink: public base_sink<Mutex>
|
||||||
{
|
{
|
||||||
using MyType = stdout_sink<Mutex>;
|
using MyType = stdout_sink<Mutex>;
|
||||||
public:
|
public:
|
||||||
stdout_sink()
|
stdout_sink()
|
||||||
{}
|
{}
|
||||||
static std::shared_ptr<MyType> instance()
|
static std::shared_ptr<MyType> instance()
|
||||||
@ -40,17 +40,17 @@ namespace spdlog
|
|||||||
{
|
{
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef stdout_sink<details::null_mutex> stdout_sink_st;
|
typedef stdout_sink<details::null_mutex> stdout_sink_st;
|
||||||
typedef stdout_sink<std::mutex> stdout_sink_mt;
|
typedef stdout_sink<std::mutex> stdout_sink_mt;
|
||||||
|
|
||||||
|
|
||||||
template <class Mutex>
|
template <class Mutex>
|
||||||
class stderr_sink: public base_sink<Mutex>
|
class stderr_sink: public base_sink<Mutex>
|
||||||
{
|
{
|
||||||
using MyType = stderr_sink<Mutex>;
|
using MyType = stderr_sink<Mutex>;
|
||||||
public:
|
public:
|
||||||
stderr_sink()
|
stderr_sink()
|
||||||
{}
|
{}
|
||||||
static std::shared_ptr<MyType> instance()
|
static std::shared_ptr<MyType> instance()
|
||||||
@ -69,9 +69,9 @@ namespace spdlog
|
|||||||
{
|
{
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef stderr_sink<std::mutex> stderr_sink_mt;
|
typedef stderr_sink<std::mutex> stderr_sink_mt;
|
||||||
typedef stderr_sink<details::null_mutex> stderr_sink_st;
|
typedef stderr_sink<details::null_mutex> stderr_sink_st;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,15 +16,15 @@
|
|||||||
|
|
||||||
namespace spdlog
|
namespace spdlog
|
||||||
{
|
{
|
||||||
namespace sinks
|
namespace sinks
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Windows color console sink. Uses WriteConsoleA to write to the console with colors
|
* Windows color console sink. Uses WriteConsoleA to write to the console with colors
|
||||||
*/
|
*/
|
||||||
template<class Mutex>
|
template<class Mutex>
|
||||||
class wincolor_sink: public base_sink<Mutex>
|
class wincolor_sink: public base_sink<Mutex>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const WORD BOLD = FOREGROUND_INTENSITY;
|
const WORD BOLD = FOREGROUND_INTENSITY;
|
||||||
const WORD RED = FOREGROUND_RED;
|
const WORD RED = FOREGROUND_RED;
|
||||||
const WORD CYAN = FOREGROUND_GREEN | FOREGROUND_BLUE;
|
const WORD CYAN = FOREGROUND_GREEN | FOREGROUND_BLUE;
|
||||||
@ -70,7 +70,7 @@ namespace spdlog
|
|||||||
colors_[level] = color;
|
colors_[level] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HANDLE out_handle_;
|
HANDLE out_handle_;
|
||||||
std::map<level::level_enum, WORD> colors_;
|
std::map<level::level_enum, WORD> colors_;
|
||||||
|
|
||||||
@ -82,35 +82,35 @@ namespace spdlog
|
|||||||
SetConsoleTextAttribute(out_handle_, attribs);
|
SetConsoleTextAttribute(out_handle_, attribs);
|
||||||
return orig_buffer_info.wAttributes; //return orig attribs
|
return orig_buffer_info.wAttributes; //return orig attribs
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// windows color console to stdout
|
// windows color console to stdout
|
||||||
//
|
//
|
||||||
template<class Mutex>
|
template<class Mutex>
|
||||||
class wincolor_stdout_sink: public wincolor_sink<Mutex>
|
class wincolor_stdout_sink: public wincolor_sink<Mutex>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wincolor_stdout_sink():wincolor_sink(GetStdHandle(STD_OUTPUT_HANDLE))
|
wincolor_stdout_sink():wincolor_sink(GetStdHandle(STD_OUTPUT_HANDLE))
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef wincolor_stdout_sink<std::mutex> wincolor_stdout_sink_mt;
|
typedef wincolor_stdout_sink<std::mutex> wincolor_stdout_sink_mt;
|
||||||
typedef wincolor_stdout_sink<details::null_mutex> wincolor_stdout_sink_st;
|
typedef wincolor_stdout_sink<details::null_mutex> wincolor_stdout_sink_st;
|
||||||
|
|
||||||
//
|
//
|
||||||
// windows color console to stderr
|
// windows color console to stderr
|
||||||
//
|
//
|
||||||
template<class Mutex>
|
template<class Mutex>
|
||||||
class wincolor_stderr_sink: public wincolor_sink<Mutex>
|
class wincolor_stderr_sink: public wincolor_sink<Mutex>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wincolor_stderr_sink():wincolor_sink(GetStdHandle(STD_ERROR_HANDLE))
|
wincolor_stderr_sink():wincolor_sink(GetStdHandle(STD_ERROR_HANDLE))
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef wincolor_stderr_sink<std::mutex> wincolor_stderr_sink_mt;
|
typedef wincolor_stderr_sink<std::mutex> wincolor_stderr_sink_mt;
|
||||||
typedef wincolor_stderr_sink<details::null_mutex> wincolor_stderr_sink_st;
|
typedef wincolor_stderr_sink<details::null_mutex> wincolor_stderr_sink_st;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user