BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
appender.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <memory>
3 #include <string>
4 
5 namespace fc {
6  class appender;
7  class log_message;
8  class variant;
9 
11  public:
12  typedef std::shared_ptr<appender_factory> ptr;
13 
14  virtual ~appender_factory(){};
15  virtual std::shared_ptr<appender> create( const variant& args ) = 0;
16  };
17 
18  namespace detail {
19  template<typename T>
21  public:
22  virtual std::shared_ptr<appender> create( const variant& args ) {
23  return std::shared_ptr<appender>(new T(args));
24  }
25  };
26  }
27 
28  class appender {
29  public:
30  typedef std::shared_ptr<appender> ptr;
31 
32  template<typename T>
33  static bool register_appender(const std::string& type) {
35  }
36 
37  virtual ~appender() = default;
38  static appender::ptr create( const std::string& name, const std::string& type, const variant& args );
39  static appender::ptr get( const std::string& name );
40  static bool register_appender( const std::string& type, const appender_factory::ptr& f );
41 
42  virtual void log( const log_message& m ) = 0;
43  };
44 }
fc::appender::create
static appender::ptr create(const std::string &name, const std::string &type, const variant &args)
Definition: appender.cpp:35
fc::detail::appender_factory_impl::create
virtual std::shared_ptr< appender > create(const variant &args)
Definition: appender.hpp:22
fc::appender::~appender
virtual ~appender()=default
fc
Definition: api.hpp:15
fc::appender
Definition: appender.hpp:28
fc::appender::get
static appender::ptr get(const std::string &name)
Definition: appender.cpp:25
fc::appender::log
virtual void log(const log_message &m)=0
fc::appender_factory::~appender_factory
virtual ~appender_factory()
Definition: appender.hpp:14
fc::appender_factory::create
virtual std::shared_ptr< appender > create(const variant &args)=0
fc::log_message
aggregates a message along with the context and associated meta-information.
Definition: log_message.hpp:106
fc::appender::ptr
std::shared_ptr< appender > ptr
Definition: appender.hpp:30
fc::appender_factory::ptr
std::shared_ptr< appender_factory > ptr
Definition: appender.hpp:12
fc::variant
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition: variant.hpp:198
fc::detail::appender_factory_impl
Definition: appender.hpp:20
fc::appender::register_appender
static bool register_appender(const std::string &type)
Definition: appender.hpp:33
fc::appender_factory
Definition: appender.hpp:10