Skip to content

How to use Logger

Pooyan Dadvand edited this page Nov 20, 2017 · 18 revisions

The logging system in Kratos has 3 important parts:

  • LoggerMessage a data class storing the message with some attributes like label, category, severity
  • Logger is a singleton object in charge of gathering all messages produced in the code and passing them to the outputs
  • LoggerOutput takes message and write it to the output (or file). This is the extension point of the logger and one can create its output to write only some messages (filtering by category, severity, label, etc.) with custom format.

Sending a Message

The simplest way to send a message is to use predefined macros:

KRATOS_INFO("Some label") << "Some message with value: " << 3.14 << " with more message";

This example sends a message with INFO severity and STATUS category. One can change the category by passing it to the message:

KRATOS_INFO("Number of Iterations") << number_of_iterations << LoggerMessage::Category::STATISTICS;

Project information

Getting Started

Tutorials

Developers

Kratos structure

Conventions

Solvers

Debugging, profiling and testing

HOW TOs

Utilities

Kratos API

Kratos Structural Mechanics API

Clone this wiki locally