40 #ifndef GEOGRAM_BASIC_LOGGER
41 #define GEOGRAM_BASIC_LOGGER
82 loggerStream_(loggerStream) {
163 virtual void div(
const std::string& title) = 0;
169 virtual void out(
const std::string& str) = 0;
175 virtual void warn(
const std::string& str) = 0;
181 virtual void err(
const std::string& str) = 0;
187 virtual void status(
const std::string& str) = 0;
213 void div(
const std::string& title)
override;
218 void out(
const std::string& str)
override;
223 void warn(
const std::string& str)
override;
228 void err(
const std::string& str)
override;
234 void status(
const std::string& str)
override;
268 void div(
const std::string& title)
override;
273 void out(
const std::string& str)
override;
278 void warn(
const std::string& str)
override;
283 void err(
const std::string& str)
override;
289 void status(
const std::string& str)
override;
306 std::string log_file_name_;
307 std::ostream* log_file_;
413 static std::ostream&
div(
const std::string& title);
425 static std::ostream&
out(
const std::string& feature);
437 static std::ostream&
err(
const std::string& feature);
449 static std::ostream&
warn(
const std::string& feature);
672 const std::string& name,
const std::string& value
687 const std::string& name, std::string& value
698 std::ostream* err_console_;
703 typedef std::set<std::string> FeatureSet;
704 FeatureSet log_features_;
705 FeatureSet log_features_exclude_;
706 bool log_everything_;
707 std::string log_file_name_;
709 std::string current_feature_;
710 bool current_feature_changed_;
713 typedef std::set<LoggerClient_var> LoggerClients;
714 LoggerClients clients_;
719 bool notifying_error_;
786 extern int GEOGRAM_API
geogram_fprintf(FILE* out,
const char* format, ...);
Logger client that redirects messages to standard output.
void warn(const std::string &str) override
Handles a warning message.
void div(const std::string &title) override
Creates a new division.
void status(const std::string &str) override
Handles a status message.
~ConsoleLogger() override
ConsoleLogger destructor.
ConsoleLogger()
Creates a ConsoleLogger.
void out(const std::string &str) override
Handles an information message.
void err(const std::string &str) override
Handles an error message.
Base class for reference-counted objects.
Logger client that redirects messages to a file.
FileLogger(const std::string &file_name)
Creates logger that logs messages to a file.
void set_file_name(const std::string &file_name)
Sets the log file name.
void out(const std::string &str) override
Handles an information message.
void err(const std::string &str) override
Handles an error message.
FileLogger()
Creates an empty file logger.
void warn(const std::string &str) override
Handles a warning message.
~FileLogger() override
FileLogger destructor.
void status(const std::string &str) override
Handles a status message.
void div(const std::string &title) override
Creates a new division.
Logger client base class.
virtual void div(const std::string &title)=0
Creates a new division.
virtual void status(const std::string &str)=0
Handles a status message.
virtual void err(const std::string &str)=0
Handles an error message.
virtual void warn(const std::string &str)=0
Handles a warning message.
virtual void out(const std::string &str)=0
Handles an information message.
~LoggerClient() override
LoggerClient destructor.
Stream buffer used by the LoggerStreams.
LoggerStreamBuf(LoggerStream *loggerStream)
Creates a Logger stream buffer.
Stream used by the Logger.
~LoggerStream() override
Logger stream destructor.
LoggerStream(Logger *logger)
Creates a Logger stream.
void notify(const std::string &str)
Sends a string to the Logger.
Generic logging framework.
std::ostream & div_stream(const std::string &title)
Creates a division in the log output.
static std::ostream & warn(const std::string &feature)
Gets the stream to send warning messages.
void set_minimal(bool flag)
Sets the minimal mode.
void unregister_client(LoggerClient *client)
Removes a client from the Logger.
~Logger() override
Logger destructor.
static std::ostream & div(const std::string &title)
Creates a division in the log output.
static void initialize()
Initializes the logging system.
void set_quiet(bool flag)
Sets the quiet mode.
static void terminate()
Terminates the logging system.
std::ostream & status_stream()
Gets the stream to send status messages.
bool is_pretty() const
Checks the console pretty mode.
static bool is_initialized()
Tests whether the Logger is initialized.
std::ostream & warn_stream(const std::string &feature)
Gets the stream to send warning messages.
std::ostream & err_stream(const std::string &feature)
Gets the stream to send error messages.
bool is_client(LoggerClient *client) const
Checks if a client is registered.
void set_pretty(bool flag)
Sets the console pretty mode.
Logger()
Logger default constructor.
void notify_warn(const std::string &message)
Handles a warning message.
bool get_local_value(const std::string &name, std::string &value) const override
Gets a Logger property.
void unregister_all_clients()
Unregisters all the registered clients.
bool is_minimal() const
Checks the minimal mode.
bool is_quiet() const
Checks the quiet mode.
void notify_err(const std::string &message)
Handles an error message.
void register_client(LoggerClient *client)
Adds a client to the Logger.
std::ostream & out_stream(const std::string &feature)
Gets the stream to send information messages.
static Logger * instance()
Returns the Logger single instance.
std::ostream & err_console()
Gets an output stream that sends messages to the standard error.
void notify_out(const std::string &message)
Handles an information message.
bool set_local_value(const std::string &name, const std::string &value) override
Sets a Logger property.
void notify_status(const std::string &message)
Handles a status message.
void notify(LoggerStream *sender, const std::string &message)
Receives a message from a logger stream.
static std::ostream & err(const std::string &feature)
Gets the stream to send error messages.
static std::ostream & status()
Gets the stream to send status messages.
static std::ostream & out(const std::string &feature)
Gets the stream to send information messages.
A smart pointer with reference-counted copy semantics.
Provides a mechanism to store global variables, retrieve them by their names and attach observers to ...
#define NO_GEOGRAM_API
A place-holder linkage declaration to indicate that the symbol should not be exported by Windows DLLs...
Common include file, providing basic definitions. Should be included before anything else by all head...
int geogram_fprintf(FILE *out, const char *format,...)
Fprintf-like wrapper to the Logger.
int geogram_printf(const char *format,...)
Printf-like wrapper to the Logger.
Global Vorpaline namespace.
SmartPointer< LoggerClient > LoggerClient_var
Function and classes for process manipulation.