Template Class client

Inheritance Relationships

Derived Types

Class Documentation

template<typename T>
class client

A class that can connect to a logging server for logging of important events. Basically a thin wrapper around log4cxx. If ER_NDEBUG is defined, then this class will mostly compile away to nothing, and most member functions will not be defined.

Subclassed by rcppsw::ds::base_grid_overlay< math::vector2d >, rcppsw::ds::base_grid_overlay< math::vector3d >, rcppsw::math::range< rcppsw::math::radians >, rcppsw::math::range< rcppsw::math::degrees >, rcppsw::math::range< coord_value_type >, rcppsw::spatial::measurement< int, struct manhattan_dist_tag >, rcppsw::spatial::measurement< double, struct euclidean_dist_tag >

Public Functions

inline explicit client(const char *abiname)
Parameters:

abiname – The demangled ABI name of the client class.

client(const client&) = default
virtual ~client(void) = default
inline void env_verify(void)

Verify that the execution environment was properly set up for logging, and abort the program if it was not.

inline void logfile_set(const std::string &name)

Set the logfile of the logger with the specified name. Not idempotent.

This is not done during construction because you often want to direct entire namespaces of loggers to a single output file (e.g., rcppsw.patterns).

inline log4cxx::LoggerPtr logger(void) const

Get a reference to the ER logger.

inline std::string logger_name(void) const

Get current logger name.

client &operator=(const client&) = default

Public Static Functions

static inline void logfile_set(const log4cxx::LoggerPtr &logger, const std::string &name)

Set the log file for the specified logger. Idempotent. If the logfile currently exists, it will be truncated.

Logfile is an appender, which is given the same name as the logfile itself.

static inline void logging_init(const std::string &fpath)

Initialize logging by specifying the path to the log4cxx configuration file.

static inline void mdc_add(const std::string &key, const std::string &value)

Add a log4cxx MDC context.

Parameters:
  • key – The context key.

  • value – The context.

static inline void mdc_rm(const std::string &key)

Remove a log4cxx MDC context.

static inline void ndc_pop(void)

Pop the top of the log4cxx NDC stack.

static inline void ndc_push(const std::string &s)

Push a log4cxx NDC context.

Parameters:

s – The context.