Logger class to provide interface to basic functions of the logger.
More...
#include <Logger.h>
|
|
using | LogLevel = spdlog::level::level_enum |
| | Typealias for log levels.
|
| |
|
| static std::shared_ptr< spdlog::logger > | get () |
| | Get the pointer to the spdlog logger.
|
| |
| static void | create (std::ostream &logOutputStream=std::cout) |
| | Explicitly initialize/reset the logger to write to an output stream.
|
| |
| static void | create (const std::string &filename) |
| | Explicitly initialize/reset the logger to write to a file.
|
| |
| static void | unregister () |
| | Removes the logger from the registry.
|
| |
Logger class to provide interface to basic functions of the logger.
It manages the lifecycle safely using lazy initialization.
◆ create() [1/2]
| static void autopas::Logger::create |
( |
const std::string & |
filename | ) |
|
|
inlinestatic |
Explicitly initialize/reset the logger to write to a file.
- Parameters
-
| filename | Path to the log file. |
◆ create() [2/2]
| static void autopas::Logger::create |
( |
std::ostream & |
logOutputStream = std::cout | ) |
|
|
inlinestatic |
Explicitly initialize/reset the logger to write to an output stream.
- Parameters
-
| logOutputStream | Stream to write to (default std::cout) |
◆ get()
| static std::shared_ptr< spdlog::logger > autopas::Logger::get |
( |
| ) |
|
|
inlinestatic |
Get the pointer to the spdlog logger.
If the logger does not exist yet (e.g., during static initialization), this function will automatically create a default one (std::cout). This guarantees that Logger::get() never returns nullptr.
- Returns
- Shared pointer to the logger.
◆ unregister()
| static void autopas::Logger::unregister |
( |
| ) |
|
|
inlinestatic |
Removes the logger from the registry.
Usually not needed unless you want to silence leak detectors at the very end of main().
The documentation for this class was generated from the following file: