9#ifndef __6f06a5790b0b46cf94fb3cc3cc0cc2d3
10#define __6f06a5790b0b46cf94fb3cc3cc0cc2d3
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;
107template <
class MATRIX>
108struct fmt::is_range<
lf::base::internal::enable_if_eigen<MATRIX>, char> {
109 static FMT_CONSTEXPR_DECL
const bool value =
false;
116template <
class MATRIX>
117struct fmt::formatter<
lf::base::internal::enable_if_eigen<MATRIX>> {
118 constexpr auto parse(
const format_parse_context& ctx) {
119 const auto* it = ctx.begin();
120 const auto* end = ctx.end();
122 if (it != end && *it !=
'}') {
123 throw format_error(
"invalid format");
129 template <
typename FormatContext>
130 auto format(
const MATRIX& m, FormatContext& ctx) {
131 std::stringstream ss;
132 ss << m.format(clean_fmt);
136 std::copy(str.begin(), str.end(), it);
141 static inline const Eigen::IOFormat clean_fmt =
142 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 ...