xte::logger::warn {}

Defined in header <xte/io/logger.hpp>

Prints a message with a 'WARN' prefix. The object is intended to be discarded after construction. Text is colored only when printing to a TTY.


Definition

template<typename... Args>
struct warn {
	explicit warn(std::format_string<Args...>, Args&&...) noexcept(false);

	explicit warn(std::FILE*, std::format_string<Args...>, Args&&...) noexcept(false);
};

template<typename... Args>
warn(std::format_string<Args...>, Args&&...) -> warn<Args...>;

template<typename... Args>
warn(std::FILE*, std::format_string<Args...>, Args&&...) -> warn<Args...>;



Example

xte::logger::warn("Hello, world!");
Possible output:
WARN  [2026-04-13 20:13:40] main.cpp:int main():4: Hello, world!
[View in Compiler Explorer]