bool configure_logging( const logging_config& cfg )
{
try {
static bool reg_console_appender = appender::register_appender<console_appender>( "console" );
static bool reg_gelf_appender = appender::register_appender<gelf_appender>( "gelf" );
get_logger_map().clear();
get_appender_map().clear();
支持输出到 console 和 gelf 两种方式
namespace fc
{
// Log appender that sends log messages in JSON format over UDP
// https://www.graylog2.org/resources/gelf/specification
class gelf_appender final : public appender
{
public:
struct config
{
string endpoint = "127.0.0.1:12201";
string host = "fc"; // the name of the host, source or application that sent this message (just passed through to GELF server)
};
类似 https://github.com/mattwcole/gelf-extensions-logging
版权属于:区块链中文技术社区 / 转载原创者
本文链接:https://bcskill.com/index.php/archives/636.html
相关技术文章仅限于相关区块链底层技术研究,禁止用于非法用途,后果自负!本站严格遵守一切相关法律政策!