9#include "spdlog_utils.h"
11#include <spdlog/pattern_formatter.h>
12#include <spdlog/sinks/stdout_color_sinks.h>
16std::shared_ptr<spdlog::logger>
InitLogger(
const std::string& name) {
17 auto result = spdlog::stdout_color_mt(name);
18 result->set_formatter(std::make_unique<LineFeedFormatter>(
19 std::make_unique<spdlog::pattern_formatter>()));
24 std::unique_ptr<spdlog::formatter> wrapped_formatter)
25 : wrapped_formatter_(std::move(wrapped_formatter)) {}
28 spdlog::memory_buf_t& dest) {
30 const auto* begin = msg.payload.begin();
32 for (
const auto* it = msg.payload.begin();; ++it) {
33 if (it == msg.payload.end() || *it ==
'\n') {
36 }
else if (offset == -1) {
39 spdlog::memory_buf_t temp_dest;
40 spdlog::details::log_msg empty_msg(msg.time, msg.source,
41 msg.logger_name, msg.level,
42 spdlog::string_view_t());
44 offset =
static_cast<int>(temp_dest.size() - 1);
47 spdlog::details::log_msg part(msg.time, msg.source, msg.logger_name,
49 spdlog::string_view_t(begin, it - begin));
51 auto old_end = dest.size();
55 std::memset(dest.data() + old_end,
' ', offset);
58 if (it == msg.payload.end()) {
Contains basic functionality that is used by other parts of LehrFEM++.
std::shared_ptr< spdlog::logger > InitLogger(const std::string &name)
Create a spdlog logger, register it in the spdlog registry and initialize it with LehrFEM++ specific ...