LCOV - code coverage report
Current view: top level - src/utils - Logger.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 24 29 82.8 %
Date: 2025-07-30 13:02: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        3904 : Logger::Logger() : _n_errors(0), _n_warnings(0) {}
      13             : 
      14        3723 : Logger::~Logger()
      15             : {
      16        3782 :   for (auto && it : _msgs)
      17         118 :     delete it;
      18        3723 : }
      19             : 
      20             : void
      21        7311 : Logger::emitLoggedErrors() const
      22             : {
      23        7311 :   if (_n_errors > 0)
      24             :   {
      25         152 :     std::ostringstream oss;
      26         152 :     oss << "The following errors were encountered:\n";
      27         418 :     for (const auto & msg_it : _msgs)
      28         266 :       if (msg_it->_type == ERROR)
      29         258 :         oss << "  - " << msg_it->_msg << "\n";
      30         152 :     mooseError(oss.str());
      31           0 :   }
      32        7159 : }
      33             : 
      34             : void
      35        3666 : Logger::emitLoggedWarnings() const
      36             : {
      37        3666 :   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        3662 : }
      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