LCOV - code coverage report
Current view: top level - src/utils - Logger.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #31039 (75bfb3) with base bb0a08 Lines: 24 29 82.8 %
Date: 2025-11-03 14:57:48 Functions: 4 7 57.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "Logger.h"
      11             : 
      12        3926 : Logger::Logger() : _n_errors(0), _n_warnings(0) {}
      13             : 
      14        3742 : Logger::~Logger()
      15             : {
      16        3801 :   for (auto && it : _msgs)
      17         118 :     delete it;
      18        3742 : }
      19             : 
      20             : void
      21        7353 : Logger::emitLoggedErrors() const
      22             : {
      23        7353 :   if (_n_errors > 0)
      24             :   {
      25         154 :     std::ostringstream oss;
      26         154 :     oss << "The following errors were encountered:\n";
      27         422 :     for (const auto & msg_it : _msgs)
      28         268 :       if (msg_it->_type == ERROR)
      29         260 :         oss << "  - " << msg_it->_msg << "\n";
      30         154 :     mooseError(oss.str());
      31           0 :   }
      32        7199 : }
      33             : 
      34             : void
      35        3688 : Logger::emitLoggedWarnings() const
      36             : {
      37        3688 :   if (_n_warnings > 0)
      38             :   {
      39          14 :     std::ostringstream oss;
      40          14 :     oss << "The following warnings were encountered:\n";
      41          68 :     for (const auto & msg_it : _msgs)
      42          54 :       if (msg_it->_type == WARNING)
      43          46 :         oss << "  - " << msg_it->_msg << "\n";
      44          10 :     mooseWarning(oss.str());
      45          10 :   }
      46        3684 : }
      47             : 
      48             : unsigned int
      49           0 : Logger::getNumberOfErrors() const
      50             : {
      51           0 :   return _n_errors;
      52             : }
      53             : 
      54             : unsigned int
      55           0 : Logger::getNumberOfWarnings() const
      56             : {
      57           0 :   return _n_warnings;
      58             : }

Generated by: LCOV version 1.14