Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
logger.h
1#ifndef LOGGER_H
2#define LOGGER_H
3
4#include "./log_stream.h"
5
6namespace ara
7{
8 namespace log
9 {
11 class Logger
12 {
13 private:
14 std::string mContextId;
15 std::string mContextDescription;
16 LogLevel mContextDefaultLogLevel;
17 Logger(std::string ctxId,
18 std::string ctxDescription,
19 LogLevel ctxDefLogLevel);
20
21 public:
22 Logger() = delete;
23 ~Logger() noexcept = default;
24
27 ClientState RemoteClientState() const noexcept;
28
32 LogStream LogFatal() const;
33
37 LogStream LogError() const;
38
42 LogStream LogWarn() const;
43
47 LogStream LogInfo() const;
48
52 LogStream LogDebug() const;
53
57 LogStream LogVerbose() const;
58
62 bool IsEnabled(LogLevel logLevel) const noexcept;
63
67 LogStream WithLevel(LogLevel logLevel) const;
68
75 static Logger CreateLogger(
76 std::string ctxId,
77 std::string ctxDescription,
78 LogLevel ctxDefLogLevel);
79 };
80 }
81}
82
83#endif
A stream pipeline to combine log entities.
Definition: log_stream.h:17
Logger of a specific context.
Definition: logger.h:12
LogStream LogWarn() const
Create a stream for warning logs.
Definition: logger.cpp:33
LogStream LogDebug() const
Create a stream for debug logs.
Definition: logger.cpp:45
bool IsEnabled(LogLevel logLevel) const noexcept
Determine whether a certian log level is enabled in the current context or not.
Definition: logger.cpp:57
LogStream LogError() const
Create a stream for error logs.
Definition: logger.cpp:27
LogStream WithLevel(LogLevel logLevel) const
Create a stream for certian level logs.
Definition: logger.cpp:64
LogStream LogFatal() const
Create a stream for fatal logs.
Definition: logger.cpp:21
ClientState RemoteClientState() const noexcept
Remote logging client connection state.
Definition: logger.cpp:15
static Logger CreateLogger(std::string ctxId, std::string ctxDescription, LogLevel ctxDefLogLevel)
Logger factory.
Definition: logger.cpp:79
LogStream LogVerbose() const
Create a stream for verbose logs.
Definition: logger.cpp:51
LogStream LogInfo() const
Create a stream for information logs.
Definition: logger.cpp:39
LogLevel
Log severity level.
Definition: common.h:13
ClientState
Logging client connection state.
Definition: common.h:33