9#ifndef INCG6f06a5790b0b46cf94fb3cc3cc0cc2d3
10#define INCG6f06a5790b0b46cf94fb3cc3cc0cc2d3
12#include <fmt/format.h>
13#include <fmt/ranges.h>
14#include <spdlog/formatter.h>
15#include <spdlog/logger.h>
47std::shared_ptr<spdlog::logger>
InitLogger(
const std::string& name);
78 std::unique_ptr<spdlog::formatter> wrapped_formatter);
86 void format(
const spdlog::details::log_msg& msg,
87 spdlog::memory_buf_t& dest)
override;
89 [[nodiscard]] std::unique_ptr<formatter>
clone()
const override;
96template <
class MATRIX,
typename = std::enable_if_t<std::is_base_of_v<
97 Eigen::DenseBase<MATRIX>, MATRIX>>>
98using enable_if_eigen = MATRIX;
109template <
class MATRIX>
110struct fmt::formatter<
lf::base::internal::enable_if_eigen<MATRIX>> {
111 constexpr auto parse(
const format_parse_context& ctx) {
112 const auto* it = ctx.begin();
113 const auto* end = ctx.end();
115 if (it != end && *it !=
'}') {
116 throw format_error(
"invalid format");
122 template <
typename FormatContext>
123 auto format(
const MATRIX& matrix, FormatContext& ctx) {
124 std::stringstream ss;
125 ss << matrix.format(clean_fmt);
129 std::copy(str.begin(), str.end(), it);
134 static inline const Eigen::IOFormat clean_fmt =
135 Eigen::IOFormat(4, 0,
", ",
"\n",
"[",
"]");
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 ...