diff --git a/example/example.cpp b/example/example.cpp index 5e5f85d3..0d0db6b8 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -254,7 +254,7 @@ void multi_sink_example() logger.info("this message should not appear in the console, only in the file"); } -// User defined types logging by implementing operator<< +// User defined types logging struct my_type { int i = 0; @@ -262,11 +262,12 @@ struct my_type namespace fmt_lib = spdlog::fmt_lib; template<> -struct fmt_lib::formatter : fmt_lib::formatter +struct fmt_lib::formatter : fmt_lib::formatter { auto format(my_type my, format_context &ctx) - { - return formatter::format(fmt_lib::format("[my_type i={}]", my.i), ctx); + { + auto &&out = ctx.out(); + return fmt_lib::format_to(out, "[my_type i={}]", my.i); } };