CloverBootloader/Include/Library/MemLogLib.h
jief 42cece9885 Fix nanosvg leaks.
Move global variable textfaces in XTheme.
Move global variable fontsDB in XTheme.
Remove XTheme member SVGParser. SVGParser is deleted just after use.
Remove XTheme members ImageSVG and ImageSVGnight. All images are
rasterized at load, so no need to keep that.
Remove XIcon setFilled because XIcon knows if it's filled or not by
checking Image & ImageNight
2023-11-08 14:35:22 +01:00

169 lines
3.6 KiB
C

/** @file
Provides simple log services to memory buffer.
**/
#ifndef __MEMLOG_LIB_H__
#define __MEMLOG_LIB_H__
//
// Mem log sizes
//
#define MEM_LOG_INITIAL_SIZE (128 * 1024)
#ifdef JIEF_DEBUG
#define MEM_LOG_MAX_SIZE (10 * 1024 * 1024)
#else
#define MEM_LOG_MAX_SIZE (2 * 1024 * 1024)
#endif
#define MEM_LOG_MAX_LINE_SIZE 1024
/** Callback that can be installed to be called when some message is printed with MemLog() or MemLogVA(). **/
typedef VOID (EFIAPI *MEM_LOG_CALLBACK) (IN INTN DebugMode, IN CHAR8 *LastMessage);
EFI_STATUS
EFIAPI
MemLogInit (
VOID
);
/**
Prints a log message to memory buffer.
@param Timing TRUE to prepend timing to log.
@param DebugMode DebugMode will be passed to Callback function if it is set.
@param Format The format string for the debug message to print.
@param Marker VA_LIST with variable arguments for Format.
**/
VOID
EFIAPI
MemLogVA (
IN CONST BOOLEAN Timing,
IN CONST INTN DebugMode,
IN CONST CHAR8 *Format,
IN VA_LIST Marker
);
/**
Prints a log message to memory buffer.
If Format is NULL, then does nothing.
@param Timing TRUE to prepend timing to log.
@param DebugMode DebugMode will be passed to Callback function if it is set.
@param Format The format string for the debug message to print.
@param ... The variable argument list whose contents are accessed
based on the format string specified by Format.
**/
VOID
EFIAPI
MemLog (
IN CONST BOOLEAN Timing,
IN CONST INTN DebugMode,
IN CONST CHAR8 *Format,
...
);
/**
Returns pointer to MemLog buffer.
**/
CHAR8*
EFIAPI
GetMemLogBuffer (
VOID
);
/**
Returns the length of log (number of chars written) in mem buffer.
**/
UINTN
EFIAPI
GetMemLogLen (
VOID
);
/**
Sets callback that will be called when message is added to mem log.
**/
VOID
EFIAPI
SetMemLogCallback (
MEM_LOG_CALLBACK Callback
);
/**
Sets callback that will be called when message is added to mem log.
**/
MEM_LOG_CALLBACK
EFIAPI
GetMemLogCallback (void);
/**
Returns TSC ticks per second.
**/
UINT64
EFIAPI
GetMemLogTscTicksPerSecond (VOID);
/* new function that use printf like format (%s and %ls for example). We need both because only Clover use the new one. Not the drivers and protocols */
/**
Prints a log message to memory buffer.
@param Timing TRUE to prepend timing to log.
@param DebugMode DebugMode will be passed to Callback function if it is set.
@param Format The format string for the debug message to print.
@param Marker VA_LIST with variable arguments for Format.
**/
VOID
EFIAPI
MemLogfVA (
IN CONST BOOLEAN Timing,
IN CONST INTN DebugMode,
IN CONST CHAR8 *Format,
IN VA_LIST Marker
);
/**
Prints a log message to memory buffer.
If Format is NULL, then does nothing.
@param Timing TRUE to prepend timing to log.
@param DebugMode DebugMode will be passed to Callback function if it is set.
@param Format The format string for the debug message to print.
@param ... The variable argument list whose contents are accessed
based on the format string specified by Format.
**/
#ifdef _MSC_VER
#define __attribute__(x)
#endif
VOID
EFIAPI
MemLogf (
IN CONST BOOLEAN Timing,
IN CONST INTN DebugMode,
IN CONST CHAR8 *Format,
...
) __attribute__((format(printf, 3, 4)));
#endif // __MEMLOG_LIB_H__