https://mooseframework.inl.gov
LoggingInterface.h
Go to the documentation of this file.
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 #pragma once
11 
12 #include "Logger.h"
13 
14 class FEProblemBase;
15 
23 {
24 public:
31 
35  template <typename... Args>
36  void logError(Args &&... args) const
37  {
38  _log.add(Logger::ERROR, std::forward<Args>(args)...);
39  }
40 
46  template <typename... Args>
47  void logComponentError(const std::string & component_name, Args &&... args) const
48  {
49  _log.add(Logger::ERROR, component_name, ": ", std::forward<Args>(args)...);
50  }
51 
55  template <typename... Args>
56  void logWarning(Args &&... args) const
57  {
58  _log.add(Logger::WARNING, std::forward<Args>(args)...);
59  }
60 
66  template <typename... Args>
67  void logComponentWarning(const std::string & component_name, Args &&... args) const
68  {
69  _log.add(Logger::WARNING, component_name, ": ", std::forward<Args>(args)...);
70  }
71 
72 protected:
74 };
Keeps the error and warning messages.
Definition: Logger.h:17
void logComponentWarning(const std::string &component_name, Args &&... args) const
Logs a warning for a component.
void logComponentError(const std::string &component_name, Args &&... args) const
Logs an error for a component.
Interface class for logging errors and warnings.
void logError(Args &&... args) const
Logs an error.
void logWarning(Args &&... args) const
Logs a warning.
auto log(const T &)
LoggingInterface(Logger &log)
Constructor.
void add(EMessageType type, Args &&... args)
Add a message to the log.
Definition: Logger.h:35