CppLogging 1.0.5.0
C++ Logging Library
Loading...
Searching...
No Matches
text_layout.h
Go to the documentation of this file.
1
9#ifndef CPPLOGGING_LAYOUTS_TEXT_LAYOUT_H
10#define CPPLOGGING_LAYOUTS_TEXT_LAYOUT_H
11
12#include "logging/layout.h"
13
14#include <memory>
15#include <string>
16
17namespace CppLogging {
18
20
47class TextLayout : public Layout
48{
49public:
51
54 explicit TextLayout(const std::string& pattern = "{UtcDateTime} [{Thread}] {Level} {Logger} - {Message}{EndLine}");
55 TextLayout(const TextLayout&) = delete;
56 TextLayout(TextLayout&& layout) = delete;
57 virtual ~TextLayout();
58
59 TextLayout& operator=(const TextLayout&) = delete;
60 TextLayout& operator=(TextLayout&& layout) = delete;
61
63 const std::string& pattern() const noexcept;
64
65 // Implementation of Layout
66 void LayoutRecord(Record& record) override;
67
68private:
69 class Impl;
70
71 Impl& impl() noexcept { return reinterpret_cast<Impl&>(_storage); }
72 const Impl& impl() const noexcept { return reinterpret_cast<Impl const&>(_storage); }
73
74 static const size_t StorageSize = 72;
75 static const size_t StorageAlign = 8;
76 alignas(StorageAlign) std::byte _storage[StorageSize];
77};
78
79} // namespace CppLogging
80
81#endif // CPPLOGGING_LAYOUTS_TEXT_LAYOUT_H
Logging layout interface.
Definition layout.h:28
Logging record.
Definition record.h:37
TextLayout(const TextLayout &)=delete
TextLayout & operator=(TextLayout &&layout)=delete
void LayoutRecord(Record &record) override
Layout the given logging record into a raw buffer.
TextLayout(TextLayout &&layout)=delete
const std::string & pattern() const noexcept
Get the text layout pattern.
TextLayout & operator=(const TextLayout &)=delete
Logging layout interface definition.
C++ Logging project definitions.
Definition appender.h:15