Clingo
Loading...
Searching...
No Matches
CppClingo::Logger Class Reference

Simple logger to report message to stderr or via a callback. More...

#include <logger.hh>

Public Types

using Printer = std::function< void(MessageCode, std::string_view)>
 Callback to report messages.
 

Public Member Functions

 Logger (size_t limit=default_message_limit)
 Construct a logger reporting messages to stderr.
 
 Logger (Printer p, size_t limit=default_message_limit)
 Construct a logger reporting messages via the given callback.
 
auto check (MessageCode code) -> bool
 Check if a message with the given code should be reported.
 
void enable (MessageCode code, bool enable)
 Enable or disable a message code.
 
auto enabled (MessageCode code) const -> bool
 Check if the given message code is enabled.
 
void print (MessageCode code, std::string_view msg)
 Unconditionally output a message with a given code.
 
void set_level (LogLevel level)
 Set the log level.
 
void set_limit (size_t limit)
 Set the message limit.
 
auto message_prefix (MessageCode code) const -> std::string_view
 Get a string representation of the message category.
 
void reset ()
 Reset the logger to the constructed state.
 
void enable_color (bool color)
 Explicitly enable or disable coloring.
 

Detailed Description

Simple logger to report message to stderr or via a callback.


The documentation for this class was generated from the following file: