libadc-cxx 1.0.0
Structured logging for scientific computing
Loading...
Searching...
No Matches
Public Member Functions | List of all members
adc::factory Class Reference

provides publishers and builders of application metadata. More...

#include <factory.hpp>

Public Member Functions

std::shared_ptr< publisher_apiget_publisher (const std::string &name)
 
std::shared_ptr< publisher_apiget_publisher (const std::string &name, const std::map< std::string, std::string > &opts)
 
const std::set< std::string > & get_publisher_names ()
 
std::shared_ptr< multi_publisher_apiget_multi_publisher ()
 
std::shared_ptr< multi_publisher_apiget_multi_publisher_from_env (const std::string &env_name)
 
std::shared_ptr< multi_publisher_apiget_multi_publisher_from_env (std::vector< std::string > &plugin_list)
 
std::shared_ptr< builder_apiget_builder ()
 

Detailed Description

provides publishers and builders of application metadata.

This class provides builders of abstracted metadata objects and publishers. Generally an application will create and configure one publisher (or a multipublisher) and as many builder objects as needed. In most cases, a new builder object is used for each published event.

Definition at line 34 of file factory.hpp.

Member Function Documentation

◆ get_publisher() [1/2]

std::shared_ptr< publisher_api > adc::factory::get_publisher ( const std::string &  name)
Returns
a publisher instance
Parameters
nameone of the elements found with get_publisher_names().

Definition at line 178 of file factory.ipp.

◆ get_publisher() [2/2]

std::shared_ptr< publisher_api > adc::factory::get_publisher ( const std::string &  name,
const std::map< std::string, std::string > &  opts 
)
Returns
a publisher instance, or an empty pointer if the name is unavailable.
Parameters
nameone of the elements found with get_publisher_names().
optsa map of option names and their values; plugins will silently ignore unused options.

Definition at line 235 of file factory.ipp.

◆ get_publisher_names()

const std::set< std::string > & adc::factory::get_publisher_names ( )
Returns
the names of publishers available. The "none", "stdout", "file", "multifile", "syslog", and "script" publishers are always available in Linux environments.

Definition at line 294 of file factory.ipp.

◆ get_multi_publisher()

std::shared_ptr< multi_publisher_api > adc::factory::get_multi_publisher ( )
Returns
a multipublisher instance for populating.

multi_publisher provides a convenient way to publish on multiple publishers without duplicate calls to a publish() function.

Definition at line 115 of file factory.ipp.

◆ get_multi_publisher_from_env() [1/2]

std::shared_ptr< multi_publisher_api > adc::factory::get_multi_publisher_from_env ( const std::string &  env_name)
Returns
a multipublisher instance pre-populated using env_name.

This function creates a multi_publisher pre-configured with the publisher plugins named in the given environment variable. If the environment variable given is the empty string, then publishers named in the environment variable ADC_MULTI_PUBLISHER_NAMES are created. Plugin names in the environment variable are colon-separated. In either case, the publishers are configured using their defaults and plugin-specific environment variables documented by each plugin implementation.

Definition at line 121 of file factory.ipp.

◆ get_multi_publisher_from_env() [2/2]

std::shared_ptr< multi_publisher_api > adc::factory::get_multi_publisher_from_env ( std::vector< std::string > &  plugin_list)
Returns
a multipublisher instance pre-populated from environment settings for the listed plugins.

This function creates a multi_publisher pre-configured with the publisher plugins named in the input vector. If the input vector is empty, this is equivalent to get_multi_publisher().

Definition at line 137 of file factory.ipp.

◆ get_builder()

std::shared_ptr< builder_api > adc::factory::get_builder ( )
Returns
an empty json builder object

Definition at line 300 of file factory.ipp.


The documentation for this class was generated from the following files: