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->clear();
97 other.formatted_msg->reserve(formatted_msg->size());
98 other.formatted_msg->append(*formatted_msg);
102 other.
extra_data = std::make_unique<ExtraData>(*extra_data);
104 if (other.
extra_data->runtime_metadata.has_runtime_metadata)
107 other.macro_metadata = &other.
extra_data->runtime_metadata.macro_metadata;
113 QUILL_NODISCARD QUILL_ATTRIBUTE_HOT LogLevel log_level()
const noexcept
115 return macro_metadata->log_level();
119 QUILL_NODISCARD QUILL_ATTRIBUTE_HOT std::vector<std::pair<std::string, std::string>>* get_named_args()
const noexcept
125 QUILL_ATTRIBUTE_HOT
void ensure_extra_data() noexcept
139 RuntimeMetadata(
char const* file, uint32_t line,
char const*
function,
char const* in_tags,
140 char const* in_fmt, LogLevel log_level)
142 source_location(_format_file_location(file, line)),
143 function_name(
function),
145 macro_metadata(source_location.data(), function_name.data(), fmt.data(),
146 tags.empty() ? nullptr : tags.data(), log_level, MacroMetadata::Event::Log),
147 has_runtime_metadata(
true)
153 source_location(other.source_location),
154 function_name(other.function_name),
156 macro_metadata(source_location.data(), function_name.data(), fmt.data(),
157 tags.empty() ? nullptr : tags.data(), other.macro_metadata.log_level(),
158 MacroMetadata::Event::Log),
159 has_runtime_metadata(other.has_runtime_metadata)
169 source_location = other.source_location;
170 function_name = other.function_name;
172 has_runtime_metadata = other.has_runtime_metadata;
175 macro_metadata =
MacroMetadata(source_location.data(), function_name.data(), fmt.data(),
176 tags.empty() ? nullptr : tags.data(),
177 other.macro_metadata.log_level(), MacroMetadata::Event::Log);
186 std::string source_location;
187 std::string function_name;
190 bool has_runtime_metadata{
false};
193 QUILL_NODISCARD
static std::string _format_file_location(
char const* file, uint32_t line)
195 if (!file || (file[0] ==
'\0' && line == 0))
197 return std::string{};
201 return std::string{file} +
":" + std::to_string(line);
209 std::vector<std::pair<std::string, std::string>> named_args;
213 uint64_t timestamp{0};
216 std::unique_ptr<FormatBuffer> formatted_msg{std::make_unique<FormatBuffer>()};
std::unique_ptr< ExtraData > extra_data
buffer for message
Definition: TransitEvent.h:217
Definition: TransitEvent.h:32
Setups a signal handler to handle fatal signals.
Definition: BackendManager.h:24
Definition: LoggerBase.h:35
std::atomic< bool > * flush_flag
A unique ptr to save space as these fields not always used.
Definition: TransitEvent.h:218