File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66#include "netlog.h"
77#include "util.h"
88
9+ static Mutex g_log_mutex ;
910static uint32_t g_device_mask ;
1011
1112const char log_file_path [] = "sdmc:/vita2hos/log.txt" ;
@@ -26,13 +27,16 @@ void file_log(const char *str)
2627
2728void log_init (uint32_t device_mask )
2829{
30+ mutexInit (& g_log_mutex );
2931 g_device_mask = device_mask ;
3032}
3133
3234void log_print (const char * str )
3335{
3436 const size_t len = strlen (str );
3537
38+ mutexLock (& g_log_mutex );
39+
3640 if (g_device_mask & LOG_DEVICE_SVC ) {
3741 svcOutputDebugString (str , len );
3842 svcOutputDebugString ("\n" , 1 );
@@ -45,11 +49,13 @@ void log_print(const char *str)
4549
4650 if (g_device_mask & LOG_DEVICE_FILE )
4751 file_log (str );
52+
53+ mutexUnlock (& g_log_mutex );
4854}
4955
5056void log_printf (const char * restrict format , ...)
5157{
52- static char buf [2048 ];
58+ char buf [512 ];
5359 va_list argptr ;
5460
5561 va_start (argptr , format );
You can’t perform that action at this time.
0 commit comments