You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most modern terminals on Windows now support ANSI color codes (this includes, e.g., Windows Terminal, and the good old console if created with the appropriate flags; see ENABLE_VIRTUAL_TERMINAL_PROCESSING, starting from Windows 10). ANSI color codes have the advantage of being able to survive when stdout is piped, while Windows console color commands do not (in fact, the output is just lost if the colours are set to always).
Unfortunately:
When using spdlog built as a shared or static library, the ansicolor_sink-inl.h is never included in the library, therefore simply trying to include ansicolor_sink.h and using the class results in linker errors. This can be worked around by including ansicolor_sink-inl.h explicitly.
The ANSI color sink uses ::fwrite unconditionally, which results in double carriage returns being printed on Windows. This is the same issue as stdout sink produces extra carriage returns on Windows #1675, which applied to the regular stdout sink, but now applies to the ANSI sink. The solution would be to use the same fix here, namely, use ::WriteFile on Windows and ::fwrite on linux.
The text was updated successfully, but these errors were encountered:
Most modern terminals on Windows now support ANSI color codes (this includes, e.g., Windows Terminal, and the good old console if created with the appropriate flags; see
ENABLE_VIRTUAL_TERMINAL_PROCESSING
, starting from Windows 10). ANSI color codes have the advantage of being able to survive when stdout is piped, while Windows console color commands do not (in fact, the output is just lost if the colours are set toalways
).Unfortunately:
ansicolor_sink-inl.h
is never included in the library, therefore simply trying to includeansicolor_sink.h
and using the class results in linker errors. This can be worked around by includingansicolor_sink-inl.h
explicitly.::fwrite
unconditionally, which results in double carriage returns being printed on Windows. This is the same issue as stdout sink produces extra carriage returns on Windows #1675, which applied to the regular stdout sink, but now applies to the ANSI sink. The solution would be to use the same fix here, namely, use::WriteFile
on Windows and::fwrite
on linux.The text was updated successfully, but these errors were encountered: