9 #include "quill/core/Attributes.h" 10 #include "quill/core/Codec.h" 11 #include "quill/core/LogLevel.h" 12 #include "quill/core/MacroMetadata.h" 14 #include "quill/bundled/fmt/format.h" 20 #include <string_view> 34 using FormatBuffer = fmtquill::basic_memory_buffer<char, 88>;
50 : timestamp(other.timestamp),
51 macro_metadata(other.macro_metadata),
52 logger_base(other.logger_base),
53 formatted_msg(std::move(other.formatted_msg)),
61 macro_metadata = &
extra_data->runtime_metadata.macro_metadata;
70 timestamp = other.timestamp;
71 macro_metadata = other.macro_metadata;
72 logger_base = other.logger_base;
73 formatted_msg = std::move(other.formatted_msg);
81 macro_metadata = &
extra_data->runtime_metadata.macro_metadata;
90 other.timestamp = timestamp;
91 other.macro_metadata = macro_metadata;
92 other.logger_base = logger_base;
96 other.formatted_msg->reserve(formatted_msg->size());
97 other.formatted_msg->append(*formatted_msg);
101 other.
extra_data = std::make_unique<ExtraData>(*extra_data);
103 if (other.
extra_data->runtime_metadata.has_runtime_metadata)
106 other.macro_metadata = &other.
extra_data->runtime_metadata.macro_metadata;
112 QUILL_NODISCARD QUILL_ATTRIBUTE_HOT LogLevel log_level()
const noexcept
114 return macro_metadata->log_level();
118 QUILL_NODISCARD QUILL_ATTRIBUTE_HOT std::vector<std::pair<std::string, std::string>>* get_named_args()
const noexcept
124 QUILL_ATTRIBUTE_HOT
void ensure_extra_data() noexcept
138 RuntimeMetadata(
char const* file, uint32_t line,
char const*
function,
char const* in_tags,
139 char const* in_fmt, LogLevel log_level)
141 source_location(_format_file_location(file, line)),
142 function_name(
function),
144 macro_metadata(source_location.data(), function_name.data(), fmt.data(),
145 tags.empty() ? nullptr : tags.data(), log_level, MacroMetadata::Event::Log),
146 has_runtime_metadata(
true)
152 source_location(other.source_location),
153 function_name(other.function_name),
155 macro_metadata(source_location.data(), function_name.data(), fmt.data(),
156 tags.empty() ? nullptr : tags.data(), other.macro_metadata.log_level(),
157 MacroMetadata::Event::Log),
158 has_runtime_metadata(other.has_runtime_metadata)
168 source_location = other.source_location;
169 function_name = other.function_name;
171 has_runtime_metadata = other.has_runtime_metadata;
174 macro_metadata =
MacroMetadata(source_location.data(), function_name.data(), fmt.data(),
175 tags.empty() ? nullptr : tags.data(),
176 other.macro_metadata.log_level(), MacroMetadata::Event::Log);
185 std::string source_location;
186 std::string function_name;
189 bool has_runtime_metadata{
false};
192 QUILL_NODISCARD
static std::string _format_file_location(
char const* file, uint32_t line)
194 if (!file || (file[0] ==
'\0' && line == 0))
196 return std::string{};
200 return std::string{file} +
":" + std::to_string(line);
208 std::vector<std::pair<std::string, std::string>> named_args;
212 uint64_t timestamp{0};
215 std::unique_ptr<FormatBuffer> formatted_msg{std::make_unique<FormatBuffer>()};
std::unique_ptr< ExtraData > extra_data
buffer for message
Definition: TransitEvent.h:216
Definition: TransitEvent.h:32
Setups a signal handler to handle fatal signals.
Definition: BackendManager.h:24
Definition: LoggerBase.h:36
std::atomic< bool > * flush_flag
A unique ptr to save space as these fields not always used.
Definition: TransitEvent.h:217