MessageFormatter
The `MessageFormatter` class formats log messages according to their severity levels by defining methods for setting color codes and prefix texts based on message types.
- module
- Sofa.framework.Helper
- namespace
- sofa::helper::logging
- include
- sofa/helper/logging/MessageFormatter.h
- description
The MessageFormatter class in the SOFA framework is part of the logging subsystem and does not directly contribute to any governing equations or operators used in finite element simulations. Instead, it focuses on formatting log messages according to their severity level, enhancing readability through color codes and prefix texts.
-
Governing Equations / Operators: None
-
Constitutive Laws / Kinematic Models: None
-
Role in the Global FEM Pipeline: This component does not play a role in the global FEM pipeline since it is purely concerned with logging and output formatting. It does not contribute to assembly, time integration, nonlinear solve, linear solve, constraint handling, or mapping.
-
Numerical Methods / Discretization Choices: None
-
Variational / Lagrangian Mechanics Framework Fit: This component is outside the scope of variational and Lagrangian mechanics frameworks as it does not pertain to physical simulation but rather to logging consistency across SOFA applications.
Methods
void
formatMessage
(const Message & m, int & out)
virtual
int
getPrefixText
(unsigned int type)
int &
setColor
(int & stream, unsigned int type)
{
"name": "MessageFormatter",
"namespace": "sofa::helper::logging",
"module": "Sofa.framework.Helper",
"include": "sofa/helper/logging/MessageFormatter.h",
"doc": "",
"inherits": [],
"templates": [],
"data_fields": [],
"links": [],
"methods": [
{
"name": "formatMessage",
"return_type": "void",
"params": [
{
"name": "m",
"type": "const Message &"
},
{
"name": "out",
"type": "int &"
}
],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "getPrefixText",
"return_type": "int",
"params": [
{
"name": "type",
"type": "unsigned int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "setColor",
"return_type": "int &",
"params": [
{
"name": "stream",
"type": "int &"
},
{
"name": "type",
"type": "unsigned int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
}
],
"description": "The `MessageFormatter` class in the SOFA framework is part of the logging subsystem and is responsible for formatting log messages according to their severity level (e.g., advice, warning, error). This class defines methods for setting color codes and prefix texts based on message types. It acts as an abstract base class with a pure virtual `formatMessage` method that must be implemented by derived classes to format specific messages. The `getPrefixText` and `setColor` protected methods are used internally to generate appropriate prefixes and colors for different log levels, enhancing the readability of console output. This component is essential for consistent logging across SOFA applications.",
"maths": "The `MessageFormatter` class in the SOFA framework is part of the logging subsystem and does not directly contribute to any governing equations or operators used in finite element simulations. Instead, it focuses on formatting log messages according to their severity level, enhancing readability through color codes and prefix texts.\n\n- **Governing Equations / Operators**: None\n\n- **Constitutive Laws / Kinematic Models**: None\n\n- **Role in the Global FEM Pipeline**: This component does not play a role in the global FEM pipeline since it is purely concerned with logging and output formatting. It does not contribute to assembly, time integration, nonlinear solve, linear solve, constraint handling, or mapping.\n\n- **Numerical Methods / Discretization Choices**: None\n\n- **Variational / Lagrangian Mechanics Framework Fit**: This component is outside the scope of variational and Lagrangian mechanics frameworks as it does not pertain to physical simulation but rather to logging consistency across SOFA applications.",
"abstract": "The `MessageFormatter` class formats log messages according to their severity levels by defining methods for setting color codes and prefix texts based on message types.",
"sheet": "# MessageFormatter\n\n**Overview**\n\nThe `MessageFormatter` class is an abstract base class in the SOFA logging subsystem responsible for formatting log messages. It defines a pure virtual method, `formatMessage`, which must be implemented by derived classes to format specific messages. Additionally, it provides protected methods, `getPrefixText` and `setColor`, to generate appropriate prefixes and colors for different log levels.\n\n**Practical Notes**\n\nDerived classes must implement the `formatMessage` method to ensure proper message formatting. The `getPrefixText` and `setColor` methods are used internally to enhance readability through color codes and prefix texts."
}