preCICE v3.1.2
Loading...
Searching...
No Matches
Logger.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string_view>
5
6namespace precice::logging {
7
9struct LogLocation {
10 const char *file;
11 int line;
12 const char *func;
13};
14
16class Logger {
17public:
21 explicit Logger(std::string_view module);
22
23 Logger(const Logger &other);
24 Logger(Logger &&other) noexcept;
25 Logger &operator=(Logger other);
27
28 void swap(Logger &other) noexcept;
29
32 void error(LogLocation loc, std::string_view mess) noexcept;
33 void warning(LogLocation loc, std::string_view mess) noexcept;
34 void info(LogLocation loc, std::string_view mess) noexcept;
35 void debug(LogLocation loc, std::string_view mess) noexcept;
36 void trace(LogLocation loc, std::string_view mess) noexcept;
38
39private:
41 class LoggerImpl;
42
45};
46
47} // namespace precice::logging
48
49// Include LogMacros here, because using it works only together with a Logger
50#include "LogMacros.hpp"
This class provides a lightweight logger.
Definition Logger.hpp:16
void warning(LogLocation loc, std::string_view mess) noexcept
Definition Logger.cpp:165
void error(LogLocation loc, std::string_view mess) noexcept
Definition Logger.cpp:157
Logger & operator=(Logger other)
Definition Logger.cpp:142
void debug(LogLocation loc, std::string_view mess) noexcept
Definition Logger.cpp:181
void info(LogLocation loc, std::string_view mess) noexcept
Definition Logger.cpp:173
Logger(Logger &&other) noexcept
void swap(Logger &other) noexcept
Definition Logger.cpp:148
Logger(std::string_view module)
Definition Logger.cpp:128
~Logger()
This is required for the std::unique_ptr.
std::unique_ptr< LoggerImpl > _impl
Pimpl to the logger implementation.
Definition Logger.hpp:44
void trace(LogLocation loc, std::string_view mess) noexcept
Definition Logger.cpp:189
contains the logging framework.
Struct used to capture the original location of a log request.
Definition Logger.hpp:9