Struct Logger::LogToken

Nested Relationships

This struct is a nested type of Class Logger.

Struct Documentation

struct LogToken

A small object used to make the logging API more ergonomic.

Use operator<< with it just like with std::cout to write log messages (no ending newline or std::endl necessary) You can also use LogFormatted just like you would std::format

Public Functions

LogToken() = default
LogToken(const LogToken&) = delete
LogToken(LogToken&&) = default
LogToken &operator=(const LogToken&) = delete
LogToken &operator=(LogToken&&) = default
template<typename T>
inline LogToken &operator<<(const T &value)

Add a value to the log stream.

Parameters:

value – The value to log (ostream overrides for formatting like std::ostream& operator<<(std::ostream& out, const T& val)) should work

Returns:

This object to continue the stream chain

template<typename ...Args>
inline void LogFormatted(std::format_string<Args...> fmtstr, Args&&... args)

Add a formatted string to the log stream.

Parameters:
  • fmtstr – The format string to log

  • args – The arguments to the format string

template<typename ...Args>
inline void LogFormatted(const std::locale &locale, std::format_string<Args...> fmtstr, Args&&... args)

Add a formatted string to the log stream with an explicit locale.

Parameters:
  • locale – The locale to use for formatting

  • fmtstr – The format string to log

  • args – The arguments to the format string

inline ~LogToken()

Public Members

Level lvl
std::ostringstream oss
bool isClient