Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
log_stream.h
1#ifndef LOG_STREAM_H
2#define LOG_STREAM_H
3
4#include <vector>
5#include <utility>
6#include "../core/error_code.h"
7#include "../core/instance_specifier.h"
8#include "./common.h"
9#include "./argument.h"
10
11namespace ara
12{
13 namespace log
14 {
16 class LogStream final
17 {
18 private:
19 std::string mLogs;
20 void concat(std::string &&log);
21
22 public:
24 void Flush() noexcept;
25
30 template <typename T>
32 {
33 std::string _argumentString = arg.ToString();
34 concat(std::move(_argumentString));
35
36 return *this;
37 }
38
42 LogStream &operator<<(const LogStream &value);
43
47 LogStream &operator<<(bool value);
48
52 LogStream &operator<<(uint8_t value);
53
57 LogStream &operator<<(uint32_t value);
58
62 LogStream &operator<<(float value);
63
67 LogStream &operator<<(const std::string &value);
68
72 LogStream &operator<<(const char *value);
73
78
83
88
92 LogStream &operator<<(std::vector<std::uint8_t> value);
93
98 LogStream &WithLocation(std::string file, int line);
99
102 std::string ToString() const noexcept;
103 };
104 }
105}
106
107#endif
A wrapper around the raw error code in a specific ErrorDomain.
Definition: error_code.h:13
AUTOSAR shortname-path wrapper.
Definition: instance_specifier.h:14
A payload (quantity) with an unit wrapper.
Definition: argument.h:15
std::string ToString() const
Convert the payload to a standard string.
Definition: argument.h:41
A stream pipeline to combine log entities.
Definition: log_stream.h:17
void Flush() noexcept
Clear the stream.
Definition: log_stream.cpp:14
LogStream & operator<<(const Argument< T > &arg)
Arugment insertion operator.
Definition: log_stream.h:31
LogStream & WithLocation(std::string file, int line)
Log stream at a certian file and a certian line within the file.
Definition: log_stream.cpp:149
std::string ToString() const noexcept
Convert the current log stream to a standard string.
Definition: log_stream.cpp:159
LogLevel
Log severity level.
Definition: common.h:13