mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-13 04:22:37 +01:00
whb: Modification of logging functions
* WHBLogPrint and WHBLogPrint have been renamed to WHBLogWrite and WHBLogWrite respectively. * WHBLogPrint and WHBLogPrintf have been re-implemented to automatically add a new line to the end of the string, and then send the string to WHBLogWrite.
This commit is contained in:
parent
84d1957066
commit
45f3cd71ab
@ -16,9 +16,15 @@ typedef void (*LogHandlerFn)(const char *msg);
|
||||
BOOL
|
||||
WHBAddLogHandler(LogHandlerFn fn);
|
||||
|
||||
BOOL
|
||||
WHBLogWrite(const char *str);
|
||||
|
||||
BOOL
|
||||
WHBLogPrint(const char *str);
|
||||
|
||||
BOOL
|
||||
WHBLogWritef(const char *fmt, ...);
|
||||
|
||||
BOOL
|
||||
WHBLogPrintf(const char *fmt, ...);
|
||||
|
||||
|
@ -26,7 +26,7 @@ WHBAddLogHandler(LogHandlerFn fn)
|
||||
}
|
||||
|
||||
BOOL
|
||||
WHBLogPrint(const char *str)
|
||||
WHBLogWrite(const char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -39,6 +39,44 @@ WHBLogPrint(const char *str)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
WHBLogPrint(const char *str)
|
||||
{
|
||||
char *buf = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4);
|
||||
BOOL result;
|
||||
|
||||
if(!buf) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
snprintf(buf, PRINTF_BUFFER_LENGTH, "%s\n", str);
|
||||
result = WHBLogWrite(buf);
|
||||
|
||||
MEMFreeToDefaultHeap(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL
|
||||
WHBLogWritef(const char *fmt, ...)
|
||||
{
|
||||
char *buf = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4);
|
||||
va_list va;
|
||||
BOOL result;
|
||||
|
||||
if (!buf) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
va_start(va, fmt);
|
||||
|
||||
vsnprintf(buf, PRINTF_BUFFER_LENGTH, fmt, va);
|
||||
result = WHBLogWrite(buf);
|
||||
|
||||
MEMFreeToDefaultHeap(buf);
|
||||
va_end(va);
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL
|
||||
WHBLogPrintf(const char *fmt, ...)
|
||||
{
|
||||
|
@ -1,10 +1,19 @@
|
||||
#include <coreinit/debug.h>
|
||||
#include <whb/log.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void
|
||||
cafeLogHandler(const char * msg)
|
||||
{
|
||||
OSReport("%s\n", msg);
|
||||
int length = strlen(msg);
|
||||
|
||||
if(msg[length-1] != '\n') {
|
||||
OSReport("%s\n", msg);
|
||||
}
|
||||
else {
|
||||
OSReport(msg);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
Loading…
Reference in New Issue
Block a user