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>
58std::shared_ptr<spdlog::logger>
InitLogger(
const std::string& name);
89 std::unique_ptr<spdlog::formatter> wrapped_formatter);
97 void format(
const spdlog::details::log_msg& msg,
98 spdlog::memory_buf_t& dest)
override;
100 [[nodiscard]] std::unique_ptr<formatter>
clone()
const override;
107template <
class MATRIX,
typename = std::enable_if_t<std::is_base_of_v<
108 Eigen::DenseBase<MATRIX>, MATRIX>>>
109using enable_if_eigen = MATRIX;
120template <
class MATRIX>
121struct fmt::formatter<
lf::base::internal::enable_if_eigen<MATRIX>> {
122 constexpr auto parse(
const format_parse_context& ctx) {
123 const auto* it = ctx.begin();
124 const auto* end = ctx.end();
126 if (it != end && *it !=
'}') {
127 throw format_error(
"invalid format");
133 template <
typename FormatContext>
134 auto format(
const MATRIX& matrix, FormatContext& ctx) {
135 std::stringstream ss;
136 ss << matrix.format(clean_fmt);
140 std::copy(str.begin(), str.end(), it);
145 static inline const Eigen::IOFormat clean_fmt =
146 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 ...