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
716 std::ostream* err_console_;
721 typedef std::set<std::string> FeatureSet;
722 FeatureSet log_features_;
723 FeatureSet log_features_exclude_;
724 bool log_everything_;
725 std::string log_file_name_;
727 std::string current_feature_;
728 bool current_feature_changed_;
731 typedef std::set<LoggerClient_var> LoggerClients;
732 LoggerClients clients_;
737 bool notifying_error_;
807extern int GEOGRAM_API
geogram_fprintf(FILE* out,
const char* format, ...);
#define NO_GEOGRAM_API
A place-holder linkage declaration to indicate that the symbol should not be exported by Windows DLLs...
#define geo_debug_assert(x)
Verifies that a condition is met.
Common include file, providing basic definitions. Should be included before anything else by all head...
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.
static std::ostream & out(const std::string &feature)
Gets the stream to send information messages.
void set_minimal(bool flag)
Sets the minimal mode.
std::ostream & err_stream(const std::string &feature)
std::ostream & div_stream(const std::string &title)
void unregister_client(LoggerClient *client)
Removes a client from the Logger.
~Logger() override
Logger destructor.
static void initialize()
Initializes the logging system.
std::ostream & out_stream(const std::string &feature)
void set_quiet(bool flag)
Sets the quiet mode.
static void terminate()
Terminates the logging system.
bool is_pretty() const
Checks the console pretty mode.
static bool is_initialized()
Tests whether the Logger is initialized.
bool is_client(LoggerClient *client) const
Checks if a client is registered.
void set_pretty(bool flag)
Sets the console pretty mode.
static std::ostream & warn(const std::string &feature)
Gets the stream to send warning messages.
static std::ostream & div(const std::string &title)
Creates a division in the log output.
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.
static std::ostream & err(const std::string &feature)
Gets the stream to send error messages.
std::ostream & warn_stream(const std::string &feature)
void indent()
Increases number of spaces before each message in out().
void notify_out(const std::string &message)
Handles an information message.
void unindent()
Decreases number of spaces before each message in out().
bool set_local_value(const std::string &name, const std::string &value) override
Sets a Logger property.
static Logger * instance()
Returns the Logger single instance.
void notify_status(const std::string &message)
Handles a status message.
std::ostream & status_stream()
void notify(LoggerStream *sender, const std::string &message)
Receives a message from a logger stream.
static std::ostream & status()
Gets the stream to send status messages.
std::ostream & err_console()
Gets an output stream that sends messages to the standard error.
A smart pointer with reference-counted copy semantics.
Scope restricted stopwatch.
Provides a mechanism to store global variables, retrieve them by their names and attach observers to ...
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.
geo_index_t index_t
The type for storing and manipulating indices.
SmartPointer< LoggerClient > LoggerClient_var
Function and classes for process manipulation.