3.4. LogΒΆ

Logging API.

Enums

log_level enum

Log level.

Values:

  • HAKA_LOG_FATAL -

    Fatal errors.

  • HAKA_LOG_ERROR -

    Errors.

  • HAKA_LOG_WARNING -

    Warning.

  • HAKA_LOG_INFO -

    Informations.

  • HAKA_LOG_DEBUG -

    Debugging informations.

  • HAKA_LOG_DEFAULT -

    Reset module log level to global one.

  • HAKA_LOG_LEVEL_LAST -

    Last log level. For internal use only.

Functions

const char * level_to_str(log_level level)

Convert a logging level to a human readable string.

Return
A string representing the logging level. This string is constant and should not be freed.

log_level str_to_level(const char * str)

Convert a logging level represented by a string to the matching enum value.

void message(log_level level, const wchar_t * module, const wchar_t * message)

Log a message without string formating.

void messagef(log_level level, const wchar_t * module, const wchar_t * fmt, ...)

Log a message with string formating.

void setlevel(log_level level, const wchar_t * module)

Set the logging level to display for a given module name. The module parameter can be NULL in which case it will set the default level.

log_level getlevel(const wchar_t * module)

Get the logging level for a given module name.

void enable_stdout_logging(bool enable)

Change the display of log message on stdout.

bool stdout_message(log_level lvl, const wchar_t * module, const wchar_t * message)

Show a log line on the stdout.

bool add_logger(struct logger * logger)

Add a new logger instance in the logger list. Each logger will receive all logging messages that are emitted by the code.

bool remove_logger(struct logger * logger)

Remove a logger.

void remove_all_logger()

Remove all loggers.

class logger

Logger instance structure.

Public Members

struct list list

void(* destroy)(struct logger *state)

int(* message)(struct logger *state, log_level level, const wchar_t *module, const wchar_t *message)

Private Members

bool mark_for_remove