ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Static Protected Member Functions | Protected Attributes | List of all members
lifecycle_manager Class Reference

Manages the starting and stopping of logging for an application. More...

#include <lifecycle_manager.hpp>

Inheritance diagram for lifecycle_manager:
Inheritance graph
Collaboration diagram for lifecycle_manager:
Collaboration graph

Public Member Functions

 lifecycle_manager (lifecycle_manager &&)=delete
 
lifecycle_manageroperator= (const lifecycle_manager &)=delete
 
 lifecycle_manager (std::optional< logging_options > ocfg)
 Initialise logging for the entire application.
 
virtual ~lifecycle_manager ()
 Shutdown logging for the entire application.
 

Protected Types

using file_sink_type = boost::log::sinks::synchronous_sink< boost::log::sinks::text_file_backend >
 
using console_sink_type = boost::log::sinks::synchronous_sink< boost::log::sinks::text_ostream_backend >
 

Static Protected Member Functions

static boost::shared_ptr< file_sink_type > make_file_sink (std::filesystem::path path, boost_severity severity, std::string tag)
 Creates a boost log file sink.
 
static boost::shared_ptr< console_sink_type > make_console_sink (boost_severity severity, std::string tag)
 Creates a boost log console sink.
 

Protected Attributes

boost::shared_ptr< file_sink_type > file_sink_
 
boost::shared_ptr< console_sink_type > console_sink_
 

Detailed Description

Manages the starting and stopping of logging for an application.

This class handles the lifecycle of console and file logging sinks. For telemetry sink support (OTLP log correlation), use the extended lifecycle_manager in ores.telemetry.

Note: this class uses boost shared_ptr due to legacy reasons (boost log does not support std::shared_ptr).

Constructor & Destructor Documentation

◆ lifecycle_manager()

lifecycle_manager ( std::optional< logging_options ocfg)
explicit

Initialise logging for the entire application.

If no configuration is supplied, logging is disabled.

Note
Must be done in a thread-safe context.

◆ ~lifecycle_manager()

~lifecycle_manager ( )
virtual

Shutdown logging for the entire application.

Should be done in a thread-safe context.

Reimplemented in lifecycle_manager.

Member Function Documentation

◆ make_file_sink()

boost::shared_ptr< lifecycle_manager::file_sink_type > make_file_sink ( std::filesystem::path  path,
boost_severity  severity,
std::string  tag 
)
staticprotected

Creates a boost log file sink.

Note
path is non-const by ref by design.
Here is the caller graph for this function: