Logging capacitiesΒΆ

class chemfiles::Logger

The Logger class is a singleton class providing logging facilities.

Public Type

LogBackend enum

Where the log message should go.

Values:

  • SILENT -

    Do not log anything.

  • STDOUT -

    Log to stdout.

  • STDERR -

    Log to stderr.

  • FILE -

    Log to a file.

  • CALLBACK -

    Log to the C callback.

typedef std::function< void(LogLevel level, const std::string &message)> logging_cb

Callback function type for logging the message at level

Public Static Functions

void log(LogLevel level, std::string message)

Log a message if the level is lower than the maximal curent logging level.

void set_level(LogLevel)

Set the logging level.

LogLevel level()

Get the current logging level.

void to_stdout()

Make the logger output to stdout.

void to_stderr()

Make the logger output to stderr.

void silent()

Silent the logger.

void to_file(const std::string & path)

Make the logger output to the file at path. The file will be created and overwrited if it already exists.

void callback(logging_cb)

Set a callback that will be called to perform logging.

LogBackend backend()

Get the current logging backend.