Logging module

Contents

Butano's logging system.

It allows to print information on the console of multiple emulators.

It can be enabled or disabled by overloading the definition of BN_CFG_LOG_ENABLED .

It supports printing on only one emulator at once. The supported emulator can be changed by overloading the definition of BN_CFG_LOG_BACKEND .

Files

file bn_config_log.h
file bn_log.h
file bn_log_backend.h

Functions

void log(const istring_base& message)
Prints in one line of text the given message.

Defines

#define BN_CFG_LOG_ENABLED
#define BN_CFG_LOG_BACKEND
#define BN_CFG_LOG_MAX_SIZE
#define BN_LOG(...)
#define BN_LOG_BACKEND_MGBA
#define BN_LOG_BACKEND_NOCASHGBA
#define BN_LOG_BACKEND_VBA

Function documentation

void log(const istring_base& message)
#include <bn_log.h>

Prints in one line of text the given message.

Define documentation

#define BN_CFG_LOG_ENABLED

Specifies if logging is enabled or not.

#define BN_CFG_LOG_BACKEND

Specifies if emulator logging is enabled or not.

Values not specified in BN_LOG_BACKEND_* macros are not allowed.

#define BN_CFG_LOG_MAX_SIZE

Specifies the maximum number of characters that can be logged with one BN_LOG call.

#define BN_LOG(...)
#include <bn_log.h>

Prints in one line of text the representation of the given parameters.

Example:

BN_LOG("Invalid integer: ", integer);

Custom parameter types are supported by overloading bn::ostringstream::operator<<.

Example:

bn::ostringstream& operator<<(bn::ostringstream& stream, const custom_type& custom_value)
{
    stream.append("custom_type: ");
    stream.append(custom_value.data);
    return stream;
}

#define BN_LOG_BACKEND_MGBA

mGBA emulator (https://mgba.io) log backend.

#define BN_LOG_BACKEND_NOCASHGBA

No$gba emulator (https://problemkaputt.de/gba.htm) log backend.

#define BN_LOG_BACKEND_VBA

VisualBoyAdvance emulator (https://en.wikipedia.org/wiki/VisualBoyAdvance) log backend.

It crashes on hardware and on other emulators!