mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-24 14:49:53 -06:00
Introduce Platform::Log
(#1640)
* Add Platform::Log and Platform::LogLevel * Replace most printf calls with Platform::Log calls * Move a brace down * Move some log entries to one Log call - Some implementations of Log may assume a full line * Log the MAC address as LogLevel::Info
This commit is contained in:

committed by
GitHub

parent
19280cff2d
commit
79dfb8dc8f
@ -60,10 +60,10 @@ void IPCInit()
|
||||
|
||||
if (!IPCBuffer->attach())
|
||||
{
|
||||
printf("IPC sharedmem doesn't exist. creating\n");
|
||||
Log(LogLevel::Info, "IPC sharedmem doesn't exist. creating\n");
|
||||
if (!IPCBuffer->create(1024))
|
||||
{
|
||||
printf("IPC sharedmem create failed :(\n");
|
||||
Log(LogLevel::Error, "IPC sharedmem create failed :(\n");
|
||||
delete IPCBuffer;
|
||||
IPCBuffer = nullptr;
|
||||
return;
|
||||
@ -88,7 +88,7 @@ void IPCInit()
|
||||
}
|
||||
IPCBuffer->unlock();
|
||||
|
||||
printf("IPC: instance ID %d\n", IPCInstanceID);
|
||||
Log(LogLevel::Info, "IPC: instance ID %d\n", IPCInstanceID);
|
||||
}
|
||||
|
||||
void IPCDeInit()
|
||||
@ -349,6 +349,17 @@ FILE* OpenLocalFile(std::string path, std::string mode)
|
||||
return OpenFile(fullpath.toStdString(), mode, mode[0] != 'w');
|
||||
}
|
||||
|
||||
void Log(LogLevel level, const char* fmt, ...)
|
||||
{
|
||||
if (fmt == nullptr)
|
||||
return;
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
Thread* Thread_Create(std::function<void()> func)
|
||||
{
|
||||
QThread* t = QThread::create(func);
|
||||
|
Reference in New Issue
Block a user