mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-19 10:29:29 +08:00
Debug refactor
This commit is contained in:
parent
161ff3b32a
commit
302db87bec
@ -169,23 +169,37 @@ struct Application {
|
|||||||
|
|
||||||
// Debug works like sprintf but mutes if the global debug flag is true
|
// Debug works like sprintf but mutes if the global debug flag is true
|
||||||
// Credit: https://stackoverflow.com/a/20639708
|
// Credit: https://stackoverflow.com/a/20639708
|
||||||
#define MAXMESSAGE 10240
|
|
||||||
|
// 5k is more than enough for a log message
|
||||||
|
#define MAXMESSAGE 1024*5
|
||||||
char logbuffer[MAXMESSAGE];
|
char logbuffer[MAXMESSAGE];
|
||||||
void Debug(struct Application *app, const char *input, ... ) {
|
void Debug(struct Application *app, const char *message, ... ) {
|
||||||
if ( debug ) {
|
if ( debug ) {
|
||||||
// 10k is more than enough for a log message
|
const char *temp = concat("LTFfenestri (C) | ", message);
|
||||||
char *message = concat("LTFfenestri (C) | ", input);
|
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, message);
|
va_start(args, message);
|
||||||
vsnprintf(logbuffer, MAXMESSAGE, message, args);
|
vsnprintf(logbuffer, MAXMESSAGE, temp, args);
|
||||||
// printf("%s", logbuffer);
|
app->sendMessageToBackend(&logbuffer[0]);
|
||||||
app->sendMessageToBackend(&logbuffer);
|
free((void*)temp);
|
||||||
//
|
|
||||||
free((void*)message);
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// // Debug works like sprintf but mutes if the global debug flag is true
|
||||||
|
// // Credit: https://stackoverflow.com/a/20639708
|
||||||
|
// void Debug(const char *message, ... ) {
|
||||||
|
// if ( debug ) {
|
||||||
|
// char *temp = concat("TRACE | Ffenestri (C) | ", message);
|
||||||
|
// message = concat(temp, "\n");
|
||||||
|
// free(temp);
|
||||||
|
// va_list args;
|
||||||
|
// va_start(args, message);
|
||||||
|
// vprintf(message, args);
|
||||||
|
// free((void*)message);
|
||||||
|
// va_end(args);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
void TitlebarAppearsTransparent(struct Application* app) {
|
void TitlebarAppearsTransparent(struct Application* app) {
|
||||||
app->titlebarAppearsTransparent = 1;
|
app->titlebarAppearsTransparent = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user