LCOV - code coverage report
Current view: top level - src - Logging.cpp (source / functions) Hit Total Coverage
Test: ad_rss_map_integration Lines: 10 10 100.0 %
Date: 2024-04-23 14:35:59 Functions: 4 4 100.0 %
Branches: 6 12 50.0 %

           Branch data     Line data    Source code
       1                 :            : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
       2                 :            : //
       3                 :            : // Copyright (C) 2019-2021 Intel Corporation
       4                 :            : //
       5                 :            : // SPDX-License-Identifier: LGPL-2.1-only
       6                 :            : //
       7                 :            : // ----------------- END LICENSE BLOCK -----------------------------------
       8                 :            : 
       9                 :            : #include "ad/rss/map/Logging.hpp"
      10                 :            : 
      11                 :            : #include <spdlog/sinks/stdout_color_sinks.h>
      12                 :            : 
      13                 :            : namespace ad {
      14                 :            : namespace rss {
      15                 :            : namespace map {
      16                 :            : 
      17                 :            : class Logging
      18                 :            : {
      19                 :            : public:
      20                 :            :   static Logging &instance();
      21                 :            : 
      22                 :            :   std::shared_ptr<spdlog::logger> mLogger;
      23                 :            : 
      24                 :            : private:
      25                 :            :   // Copy operators and constructors are deleted to avoid accidental copies
      26                 :            :   Logging(Logging const &) = delete;
      27                 :            :   Logging(Logging const &&) = delete;
      28                 :            :   Logging &operator=(Logging &&) = delete;
      29                 :            :   Logging &operator=(Logging const &) = delete;
      30                 :            : 
      31                 :            :   explicit Logging();
      32                 :            :   ~Logging();
      33                 :            : };
      34                 :            : 
      35                 :       1996 : Logging &Logging::instance()
      36                 :            : {
      37   [ +  +  +  -  :       1996 :   static Logging singleton;
             +  -  -  - ]
      38                 :       1996 :   return singleton;
      39                 :            : }
      40                 :            : 
      41                 :          1 : Logging::Logging()
      42                 :            : {
      43   [ +  -  +  - ]:          1 :   mLogger = spdlog::stdout_color_mt("rss_map_integration");
      44                 :          1 : }
      45                 :            : 
      46                 :          1 : Logging::~Logging()
      47                 :            : {
      48                 :          1 : }
      49                 :            : 
      50                 :       1996 : std::shared_ptr<spdlog::logger> getLogger()
      51                 :            : {
      52                 :       1996 :   return Logging::instance().mLogger;
      53                 :            : }
      54                 :            : 
      55                 :            : } // namespace map
      56                 :            : } // namespace rss
      57                 :            : } // namespace ad

Generated by: LCOV version 1.14