UCILoader 1.1.2
Small C++ library that allows user to connect to a chess engines via UCI protocol.
Loading...
Searching...
No Matches
UCILoader::LoggerTraits Namespace Reference

Predefined logger traits for common customizations. More...

Variables

const LoggerTraitPretty = prettyLoggerInstance
 Trait that formats log messages for human readability.
 
const LoggerTraitIgnoreParser = ignoredParserLoggerInstance
 Trait that filters out messages generated by the parser.
 
const LoggerTraitIgnoreEngine = ignoreEngineLoggerInstance
 Trait that filters out messages received from the engine.
 
const LoggerTraitIgnoreApplication = ignoreApplicationLoggerInstance
 Trait that filters out messages sent to the engine.
 
const LoggerTraitTimestamp = timestampLoggerInstance
 Trait that prepends timestamps to all logged messages.
 

Detailed Description

Predefined logger traits for common customizations.

The LoggerTraits namespace provides ready-to-use traits that can be applied to loggers to customize their behavior. Traits can be combined using the pipe operator with LoggerBuilder.

Available Traits:

  • Pretty: Formats log messages for human readability
  • IgnoreParser: Filters out messages from the parser (FromParser direction)
  • IgnoreEngine: Filters out messages from the engine (FromEngine direction)
  • IgnoreApplication: Filters out messages sent to the engine (ToEngine direction)
  • Timestamp: Prepends timestamps to each log message
See also
LoggerBuilder for how to apply traits
Loggers namespace for creating base loggers

Usage Examples:

// Log only engine messages with timestamps
auto logger = (Loggers::toFile("engine.log")
// Pretty-formatted output with all messages
auto logger = (Loggers::toStd() | LoggerTraits::Pretty).build();
// As shown in Examples/demo/main.cpp:
auto instance = ChessEngineInstanceBuilder->build(proces,
const LoggerTrait & Timestamp
Trait that prepends timestamps to all logged messages.
Definition: Logger.cpp:169
const LoggerTrait & IgnoreApplication
Trait that filters out messages sent to the engine.
Definition: Logger.cpp:168
const LoggerTrait & IgnoreParser
Trait that filters out messages generated by the parser.
Definition: Logger.cpp:166
const LoggerTrait & Pretty
Trait that formats log messages for human readability.
Definition: Logger.cpp:165
LoggerBuilder toFile(const std::string &filename)
Create a logger that outputs to a file.
Definition: Logger.cpp:185
LoggerBuilder toStd()
Create a logger that outputs to standard output.
Definition: Logger.cpp:176

Variable Documentation

◆ IgnoreApplication

const LoggerTrait & UCILoader::LoggerTraits::IgnoreApplication = ignoreApplicationLoggerInstance
extern

Trait that filters out messages sent to the engine.

Messages with direction ToEngine will be ignored.

◆ IgnoreEngine

const LoggerTrait & UCILoader::LoggerTraits::IgnoreEngine = ignoreEngineLoggerInstance
extern

Trait that filters out messages received from the engine.

Messages with direction FromEngine will be ignored.

◆ IgnoreParser

const LoggerTrait & UCILoader::LoggerTraits::IgnoreParser = ignoredParserLoggerInstance
extern

Trait that filters out messages generated by the parser.

Messages with direction FromParser will be ignored.

◆ Pretty

const LoggerTrait & UCILoader::LoggerTraits::Pretty = prettyLoggerInstance
extern

Trait that formats log messages for human readability.

The Pretty trait enhances message formatting with clear direction indicators and structured output suitable for reading log files or console output.

◆ Timestamp

const LoggerTrait & UCILoader::LoggerTraits::Timestamp = timestampLoggerInstance
extern

Trait that prepends timestamps to all logged messages.

Useful for tracking the timing of UCI protocol exchanges.