ORE Studio 0.0.4
Loading...
Searching...
No Matches
lifecycle_manager.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_TELEMETRY_LOG_LIFECYCLE_MANAGER_HPP
21#define ORES_TELEMETRY_LOG_LIFECYCLE_MANAGER_HPP
22
23#include <memory>
24#include <optional>
25#include <boost/shared_ptr.hpp>
26#include <boost/log/sinks.hpp>
27#include "ores.logging/lifecycle_manager.hpp"
28#include "ores.logging/logging_options.hpp"
29#include "ores.telemetry/log/telemetry_sink_backend.hpp"
30#include "ores.telemetry/domain/resource.hpp"
31
33
35
48private:
49 using telemetry_sink_type = boost::log::sinks::asynchronous_sink<
51
52public:
53 lifecycle_manager() = delete;
55 lifecycle_manager& operator=(const lifecycle_manager&) = delete;
56
57public:
67 explicit lifecycle_manager(std::optional<logging_options> ocfg);
68
74 ~lifecycle_manager() override;
75
97 std::shared_ptr<domain::resource> resource,
99
100private:
101 boost::shared_ptr<telemetry_sink_type> telemetry_sink_;
102};
103
104}
105
106#endif
Implements logging for ORE Studio.
Definition lifecycle_manager.hpp:32
Manages the starting and stopping of logging for an application.
Definition lifecycle_manager.hpp:43
Options related to logging.
Definition logging_options.hpp:32
Extends the base lifecycle_manager with telemetry sink support.
Definition lifecycle_manager.hpp:47
void add_telemetry_sink(std::shared_ptr< domain::resource > resource, telemetry_sink_backend::log_record_handler handler)
Adds a telemetry sink for log record correlation.
Definition lifecycle_manager.cpp:43
~lifecycle_manager() override
Shutdown logging for the entire application.
Definition lifecycle_manager.cpp:33
Boost.Log sink backend that creates telemetry log_records.
Definition telemetry_sink_backend.hpp:54
std::function< void(domain::log_record)> log_record_handler
Handler function type for processing log records.
Definition telemetry_sink_backend.hpp:63