OGLplus  (0.59.0) a C++ wrapper for rendering APIs

root_logger.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_LOGGING_ROOT_LOGGER_HPP
10 #define EAGINE_LOGGING_ROOT_LOGGER_HPP
11 
12 #include "../program_args.hpp"
13 #include "logger.hpp"
14 #include "root_logger_opts.hpp"
15 
16 namespace eagine {
17 //------------------------------------------------------------------------------
18 class application_config;
19 
22 class root_logger : public logger {
23 public:
26  identifier logger_id,
27  const program_args& args,
28  const root_logger_options& opts)
29  : logger{logger_id, {_init_backend(args, opts)}} {
30  _log_args(args);
31  _log_instance_info();
32  _log_git_info();
33  _log_compiler_info();
34  }
35 
37  root_logger(const program_args& args, const root_logger_options& opts)
38  : root_logger(EAGINE_ID(RootLogger), args, opts) {}
39 
42  : root_logger(EAGINE_ID(RootLogger), args, root_logger_options{}) {}
43 
44 private:
45  static auto _init_backend(const program_args&, const root_logger_options&)
46  -> std::unique_ptr<logger_backend>;
47 
48  auto _log_git_info() -> void;
49  auto _log_compiler_info() -> void;
50  auto _log_instance_info() -> void;
51  auto _log_args(const program_args&) -> void;
52 };
53 //------------------------------------------------------------------------------
54 } // namespace eagine
55 
56 #if !EAGINE_LINK_LIBRARY || defined(EAGINE_IMPLEMENTING_LIBRARY)
57 #include <eagine/logging/root_logger.inl>
58 #endif
59 
60 #endif // EAGINE_LOGGING_ROOT_LOGGER_HPP
#define EAGINE_ID(NAME)
Macro for constructing instances of eagine::identifier.
Definition: identifier.hpp:353
root_logger(const program_args &args, const root_logger_options &opts)
Constructor initializing from program arguments and logger options.
Definition: root_logger.hpp:37
Common code is placed in this namespace.
Definition: eagine.hpp:21
Structure holding root logger customization options.
Definition: root_logger_opts.hpp:16
Class wrapping the main function arguments, providing a convenient API.
Definition: program_args.hpp:1082
root_logger(const program_args &args)
Constructor initializing the root logger from program arguments.
Definition: root_logger.hpp:41
Class typically used as the per-application single root of logger hierarchy.
Definition: root_logger.hpp:22
Standalone logger object type.
Definition: logger.hpp:427
root_logger(identifier logger_id, const program_args &args, const root_logger_options &opts)
Constructor initializing from and id, program arguments and options.
Definition: root_logger.hpp:25

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).