LCOV - code coverage report
Current view: top level - include/hpactor/log - log_manager.hpp (source / functions) Coverage Total Hit
Test: HPActor Coverage Lines: 100.0 % 2 2
Test Date: 2026-05-20 02:24:49 Functions: 100.0 % 1 1
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : // Copyright 2026 HPActor Contributors
       2                 :             : //
       3                 :             : // Licensed under the Apache License, Version 2.0 (the "License");
       4                 :             : // you may not use this file except in compliance with the License.
       5                 :             : // You may obtain a copy of the License at
       6                 :             : //
       7                 :             : //     http://www.apache.org/licenses/LICENSE-2.0
       8                 :             : //
       9                 :             : // Unless required by applicable law or agreed to in writing, software
      10                 :             : // distributed under the License is distributed on an "AS IS" BASIS,
      11                 :             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12                 :             : // See the License for the specific language governing permissions and
      13                 :             : // limitations under the License.
      14                 :             : 
      15                 :             : #pragma once
      16                 :             : 
      17                 :             : #include "hpactor/log/log_category.hpp"
      18                 :             : #include "hpactor/log/log_config.hpp"
      19                 :             : #include "hpactor/log/log_level.hpp"
      20                 :             : #include <array>
      21                 :             : #include <memory>
      22                 :             : #include <vector>
      23                 :             : 
      24                 :             : namespace hpactor::log {
      25                 :             : 
      26                 :             : class LogRingBuffer;
      27                 :             : class LogDrain;
      28                 :             : class ILogFormatter;
      29                 :             : class ILogSink;
      30                 :             : class Logger;
      31                 :             : 
      32                 :             : class LogManager {
      33                 :             :   public:
      34                 :             :     explicit LogManager(const LogConfig& config);
      35                 :             :     ~LogManager();
      36                 :             : 
      37                 :             :     LogManager(const LogManager&) = delete;
      38                 :             :     LogManager& operator=(const LogManager&) = delete;
      39                 :             : 
      40                 :             :     void start();
      41                 :             :     void stop() noexcept;
      42                 :             : 
      43                 :         106 :     Logger& logger() noexcept {
      44                 :         106 :         return *logger_;
      45                 :             :     }
      46                 :             :     LogRingBuffer& ring_buffer() noexcept {
      47                 :             :         return *ring_buffer_;
      48                 :             :     }
      49                 :             :     const LogConfig& config() const noexcept {
      50                 :             :         return config_;
      51                 :             :     }
      52                 :             : 
      53                 :             :     uint64_t events_lost() const noexcept;
      54                 :             :     uint64_t sink_errors() const noexcept;
      55                 :             : 
      56                 :             :   private:
      57                 :             :     LogConfig config_;
      58                 :             :     std::array<LogLevel, static_cast<size_t>(LogCategory::kCount)> resolved_levels_{};
      59                 :             :     std::unique_ptr<LogRingBuffer> ring_buffer_;
      60                 :             :     std::unique_ptr<ILogFormatter> formatter_;
      61                 :             :     std::vector<std::unique_ptr<ILogSink>> sinks_;
      62                 :             :     std::unique_ptr<LogDrain> drain_;
      63                 :             :     std::unique_ptr<Logger> logger_;
      64                 :             : };
      65                 :             : 
      66                 :             : } // namespace hpactor::log
        

Generated by: LCOV version 2.0-1