Piac test code coverage report
Current view: top level - src - logging_util.cpp (source / functions) Hit Total Coverage
Commit: Piac-RELEASE Lines: 9 9 100.0 %
Date: 2022-12-16 13:44:03 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/logging_util.cpp
       4                 :            :   \copyright 2022-2025 J. Bakosi,
       5                 :            :              All rights reserved. See the LICENSE file for details.
       6                 :            :   \brief     Piac logging utilities, hookiing up with that of monero
       7                 :            : */
       8                 :            : // *****************************************************************************
       9                 :            : 
      10                 :            : #include "logging_util.hpp"
      11                 :            : 
      12                 :            : void
      13                 :         56 : piac::setup_logging( const std::string& logfile,
      14                 :            :                      const std::string& log_level,
      15                 :            :                      bool console_logging,
      16                 :            :                      const std::size_t max_log_file_size,
      17                 :            :                      const std::size_t max_log_files )
      18                 :            : // *****************************************************************************
      19                 :            : //  Hook up to monero's logging infrastructure
      20                 :            : //! \param[in] logfile Log file name
      21                 :            : //! \param[in] log_level Log level to set
      22                 :            : //! \param[in] console_logging True: enable logging to console, false: file only
      23                 :            : //! \param[in] max_log_file_size Set maximum log file size in bytes
      24                 :            : //! \param[in] max_log_files Set limit on number of log files
      25                 :            : // *****************************************************************************
      26                 :            : {
      27         [ +  - ]:        112 :   mlog_configure( mlog_get_default_log_path( logfile.c_str() ),
      28                 :            :                   console_logging, max_log_file_size, max_log_files );
      29                 :         56 :   mlog_set_log( log_level.c_str() );
      30                 :        112 :   MLOG_SET_THREAD_NAME( "main" );
      31                 :            : 
      32                 :         56 :   epee::set_console_color( epee::console_color_yellow, /* bright = */ false );
      33                 :            :   std::cout << "Logging to file '" << logfile << "' at log level "
      34                 :         56 :             << log_level << ".\n";
      35                 :         56 :   epee::set_console_color( epee::console_color_default, /* bright = */ false );
      36 [ +  - ][ +  - ]:        112 :   MINFO( "Max log file size: " << max_log_file_size << ", max log files: " <<
      37                 :            :          max_log_files );
      38                 :         56 : }

Generated by: LCOV version 1.14