libadc-cxx 1.0.0
Structured logging for scientific computing
Loading...
Searching...
No Matches
factory.hpp
Go to the documentation of this file.
1#ifndef adc_factory_hpp
2#define adc_factory_hpp
3#include <string>
4#include <string_view>
5#include <map>
6#include <set>
7#include "adc/types.hpp"
8#ifdef ADC_HAVE_MPI
9#include <mpi.h>
10#endif
14
15namespace adc {
16
17/** \addtogroup API
18 * @{
19 */
20inline version adc_factory_version("1.0.0", {"none"});
21
22// /FS/adc-log/$user/$adc_wfid/$app/$host-$pid_$start-$publisherptr.log
23// /FS/adc-log/$user/no_wfid/$app/$host-$pid_$start-$publisherptr.log
24// /FS/adc-log/$user/$cluster/$jobidraw/$task/$rank/$app/$host-$pid_$start-$publisherptr.log
25// get the list of consolidated logs from reduction of a multifile publisher tree.
26// FS/adc-log/ is multiuser; $user is owned/writable by $user
27std::vector<std::string> consolidate_multifile_logs(std::string_view dir, std::string_view match);
28
29/*!
30 \brief provides publishers and builders of application metadata.
31
32This class provides builders of abstracted metadata objects
33and publishers. Generally an application will create and configure
34one publisher (or a multipublisher) and as many builder objects
35as needed. In most cases, a new builder object is used for each published event.
36 */
37class ADC_VISIBLE factory {
38public:
39 /// \return a publisher instance
40 /// \param name one of the elements found with get_publisher_names().
41 std::shared_ptr<publisher_api> get_publisher(const std::string& name);
42
43 /** \return a publisher instance, or an empty pointer if the name is unavailable.
44 \param name one of the elements found with get_publisher_names().
45 \param opts a map of option names and their values; plugins will
46 silently ignore unused options.
47 */
48 std::shared_ptr<publisher_api> get_publisher(const std::string& name, const std::map<std::string, std::string>& opts);
49
50 /** \return the names of publishers available.
51 The "none", "stdout", "file", "multifile", "syslog", and "script" publishers are always available
52 in Linux environments.
53 */
54 const std::set<std::string>& get_publisher_names();
55
56 /** \return a multipublisher instance for populating.
57
58 multi_publisher provides a convenient way to publish on multiple
59 publishers without duplicate calls to a publish() function.
60 */
61 std::shared_ptr<multi_publisher_api> get_multi_publisher();
62
63 /** \return a multipublisher instance pre-populated from environment settings.
64
65 This function creates a multi_publisher pre-configured with the
66 publisher plugins named in the input vector. If the input vector is empty,
67 publishers named in the environment variable ADC_MULTI_PUBLISHER_NAMES are created.
68 Plugin names in the environment variable are colon-separated.
69 In both cases, the publishers are configured using their defaults and
70 plugin-specific environment variables.
71 */
72 std::shared_ptr<multi_publisher_api> get_multi_publisher(std::vector< std::string > & plugin_list);
73
74 /// \return an empty json builder object
75 std::shared_ptr<builder_api> get_builder();
76
77private:
78 std::set<std::string> names; //!< the list of publisher names
79 void init();
80
81}; // class factory
82
83/** @}*/
84
85} // namespace adc
86#endif // adc_factory_hpp
provides publishers and builders of application metadata.
Definition factory.hpp:37
version adc_factory_version("1.0.0", {"none"})
std::vector< std::string > consolidate_multifile_logs(std::string_view dir, std::string_view match)
Definition adc.hpp:75
A version with tags list.
Definition types.hpp:24