Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
logging_framework.h
1#ifndef LOGGING_FRAMEWORK_H
2#define LOGGING_FRAMEWORK_H
3
4#include <stdexcept>
5
6#include "./logger.h"
7#include "./sink/log_sink.h"
8#include "./sink/console_log_sink.h"
9#include "./sink/file_log_sink.h"
10
11namespace ara
12{
13 namespace log
14 {
17 {
18 private:
19 sink::LogSink *mLogSink;
20 LogLevel mDefaultLogLevel;
21 std::vector<Logger> mLoggers;
22
23 LoggingFramework(sink::LogSink *logSink, LogLevel logLevel);
24
25 public:
26 LoggingFramework() = delete;
27 ~LoggingFramework() noexcept;
28
33 const Logger &CreateLogger(
34 std::string ctxId,
35 std::string ctxDescription);
36
42 const Logger &CreateLogger(
43 std::string ctxId,
44 std::string ctxDescription,
45 LogLevel ctxDefLogLevel);
46
51 void Log(
52 const Logger &logger,
53 LogLevel logLevel,
54 const LogStream &logStream);
55
66 std::string appId,
67 LogMode logMode,
68 LogLevel logLevel = LogLevel::kWarn,
69 std::string appDescription = "");
70
80 std::string appId,
81 std::string filePath,
82 LogLevel logLevel = LogLevel::kWarn,
83 std::string appDescription = "");
84 };
85 }
86}
87
88#endif
A stream pipeline to combine log entities.
Definition: log_stream.h:17
Logger of a specific context.
Definition: logger.h:12
Logging framework which links loggers to a log sink.
Definition: logging_framework.h:17
void Log(const Logger &logger, LogLevel logLevel, const LogStream &logStream)
Log a stream to the determined sink.
Definition: logging_framework.cpp:41
const Logger & CreateLogger(std::string ctxId, std::string ctxDescription)
Create a logger.
Definition: logging_framework.cpp:14
static LoggingFramework * Create(std::string appId, LogMode logMode, LogLevel logLevel=LogLevel::kWarn, std::string appDescription="")
Logging framework factory.
Definition: logging_framework.cpp:56
Application logging sink.
Definition: log_sink.h:15
LogLevel
Log severity level.
Definition: common.h:13
@ kWarn
Warning log.
LogMode
Log sink mode.
Definition: common.h:25