https://mooseframework.inl.gov
LoggerTestComponent.C
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 #include "LoggerTestComponent.h"
11 
12 registerMooseObject("ThermalHydraulicsTestApp", LoggerTestComponent);
13 
16 {
18  params.addRequiredParam<bool>("log_errors", "True to log some errors.");
19  params.addRequiredParam<bool>("log_warnings", "True to log some warnings.");
20  params.addClassDescription("Component for testing Logger.");
21  return params;
22 }
23 
25  : Component(params),
26  _log_errors(getParam<bool>("log_errors")),
27  _log_warnings(getParam<bool>("log_warnings"))
28 {
29  if (_log_errors)
30  logError("error 1");
31 
32  if (_log_warnings)
33  logWarning("warning 1");
34 
35  if (_log_errors)
36  logError("error 2");
37 
38  if (_log_warnings)
39  logWarning("warning 2");
40 }
static InputParameters validParams()
void logWarning(Args &&... args) const
Logs a warning.
Definition: Component.h:224
static InputParameters validParams()
Definition: Component.C:18
void addRequiredParam(const std::string &name, const std::string &doc_string)
LoggerTestComponent(const InputParameters &params)
void logError(Args &&... args) const
Logs an error.
Definition: Component.h:215
Component for testing Logger.
registerMooseObject("ThermalHydraulicsTestApp", LoggerTestComponent)
Base class for THM components.
Definition: Component.h:27
void addClassDescription(const std::string &doc_string)