GBAlatro
A Demake of Balatro for the GBA
Loading...
Searching...
No Matches
mgba_logger.h File Reference

Interface to interact with the mgba logger. More...

#include <stdbool.h>

Go to the source code of this file.

Macros

#define MGBA_FATAL(...)   ((void)0)
 
#define MGBA_ERROR(...)   ((void)0)
 
#define MGBA_WARN(...)   ((void)0)
 
#define MGBA_INFO(...)   ((void)0)
 
#define MGBA_DEBUG(...)   ((void)0)
 
#define MGBA_FUNC_LOG(level, ...)   ((void)0)
 
#define MGBA_FUNC_FATAL(...)   ((void)0)
 
#define MGBA_FUNC_ERROR(...)   ((void)0)
 
#define MGBA_FUNC_WARN(...)   ((void)0)
 
#define MGBA_FUNC_INFO(...)   ((void)0)
 
#define MGBA_FUNC_DEBUG(...)   ((void)0)
 

Enumerations

enum  MgbaLogLevel {
  MGBA_LOG_FATAL , MGBA_LOG_ERROR , MGBA_LOG_WARN , MGBA_LOG_INFO ,
  MGBA_LOG_DEBUG
}
 

Functions

bool mgba_logger_init (void)
 Initialize mgba logger.
 
void mgba_printf (MgbaLogLevel level, const char *fmt,...)
 Print to mgba log with a format string.
 
void mgba_func_printf (MgbaLogLevel level, const char *func_name, const char *fmt,...)
 Print to mgba log with a format string and function name.
 

Detailed Description

Interface to interact with the mgba logger.

Use with mgba in the command line.

You can pass which logs you'd like to print with a flag passed to mgba with -l or --log-level.

7 6 5 4 3 2 1 0
/ / / DEBUG INFO WARN ERROR FATAL
mgba -l 3 game.rom # ERROR and FATAL
mgba -l 14 game.rom # INFO, WARN, and ERROR
Note
You have to fight with other logs in mgba and INFO can get messy.
FATAL does kill the game. Use with care.

Definition in file mgba_logger.h.

Macro Definition Documentation

◆ MGBA_DEBUG

#define MGBA_DEBUG (   ...)    ((void)0)

Definition at line 92 of file mgba_logger.h.

◆ MGBA_ERROR

#define MGBA_ERROR (   ...)    ((void)0)

Definition at line 89 of file mgba_logger.h.

◆ MGBA_FATAL

#define MGBA_FATAL (   ...)    ((void)0)

Definition at line 88 of file mgba_logger.h.

◆ MGBA_FUNC_DEBUG

#define MGBA_FUNC_DEBUG (   ...)    ((void)0)

Definition at line 100 of file mgba_logger.h.

◆ MGBA_FUNC_ERROR

#define MGBA_FUNC_ERROR (   ...)    ((void)0)

Definition at line 97 of file mgba_logger.h.

◆ MGBA_FUNC_FATAL

#define MGBA_FUNC_FATAL (   ...)    ((void)0)

Definition at line 96 of file mgba_logger.h.

◆ MGBA_FUNC_INFO

#define MGBA_FUNC_INFO (   ...)    ((void)0)

Definition at line 99 of file mgba_logger.h.

◆ MGBA_FUNC_LOG

#define MGBA_FUNC_LOG (   level,
  ... 
)    ((void)0)

Definition at line 94 of file mgba_logger.h.

◆ MGBA_FUNC_WARN

#define MGBA_FUNC_WARN (   ...)    ((void)0)

Definition at line 98 of file mgba_logger.h.

◆ MGBA_INFO

#define MGBA_INFO (   ...)    ((void)0)

Definition at line 91 of file mgba_logger.h.

◆ MGBA_WARN

#define MGBA_WARN (   ...)    ((void)0)

Definition at line 90 of file mgba_logger.h.

Enumeration Type Documentation

◆ MgbaLogLevel

enum MgbaLogLevel

Definition at line 29 of file mgba_logger.h.

Function Documentation

◆ mgba_func_printf()

void mgba_func_printf ( MgbaLogLevel  level,
const char *  func_name,
const char *  fmt,
  ... 
)

Print to mgba log with a format string and function name.

Parameters
level
func_nameFunction name - prepended to the log string "<func_name>(): <log_string>"
fmtFormat string
...variadic arguments
Note
for all logs, it's cutoff at the hard mgba limit of 0x100

Definition at line 78 of file mgba_logger.c.

◆ mgba_logger_init()

bool mgba_logger_init ( void  )

Initialize mgba logger.

Checks that the logger is available by checking the expected registers magic number

Definition at line 69 of file mgba_logger.c.

◆ mgba_printf()

void mgba_printf ( MgbaLogLevel  level,
const char *  fmt,
  ... 
)

Print to mgba log with a format string.

Parameters
level
fmtFormat string
...variadic arguments
Note
for all logs, it's cutoff at the hard mgba limit of 0x100

Definition at line 74 of file mgba_logger.c.