diff --git a/Makefile b/Makefile index 5a11fb3..2e7bab7 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,11 @@ CXXFLAGS += -DDEBUG -g CFLAGS += -DDEBUG -g endif +ifeq ($(DEBUG),VERBOSE) +CXXFLAGS += -DDEBUG -DVERBOSE_DEBUG -g +CFLAGS += -DDEBUG -DVERBOSE_DEBUG -g +endif + LIBS := -lwups -lwut -lwuhbutils -lcontentredirection -lrpxloader -lsdutils #------------------------------------------------------------------------------- diff --git a/README.md b/README.md index 3cc958f..fea0b67 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,17 @@ In order to preserve the order of homebrew apps even when you run the Wii U Menu without this plugin, this plugin will redirect the Wii U Menu save data to `sd:/wiiu/homebrew_on_menu_plugin`. When no save data is found on the sd card, the current save data is copied from the console, but after that it's never updated. +## Buildflags + +### Logging +Building via `make` only logs errors (via OSReport). To enable logging via the [LoggingModule](https://github.com/wiiu-env/LoggingModule) set `DEBUG` to `1` or `VERBOSE`. + +`make` Logs errors only (via OSReport). +`make DEBUG=1` Enables information and error logging via [LoggingModule](https://github.com/wiiu-env/LoggingModule). +`make DEBUG=VERBOSE` Enables verbose information and error logging via [LoggingModule](https://github.com/wiiu-env/LoggingModule). + +If the [LoggingModule](https://github.com/wiiu-env/LoggingModule) is not present, it'll fallback to UDP (Port 4405) and [CafeOS](https://github.com/wiiu-env/USBSerialLoggingModule) logging. + ## Building using the Dockerfile It's possible to use a docker image for building. This way you don't need anything installed on your host system. diff --git a/src/utils/logger.h b/src/utils/logger.h index a3538e1..98ea317 100644 --- a/src/utils/logger.h +++ b/src/utils/logger.h @@ -11,8 +11,6 @@ extern "C" { #define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__) -// #define VERBOSE_DEBUG - #ifdef DEBUG #ifdef VERBOSE_DEBUG @@ -34,6 +32,11 @@ extern "C" { WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \ } while (0) +#define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) \ + do { \ + WHBLogPrintf("[%23s]%30s@L%04d: ##ERROR## " FMT "\n", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \ + } while (0) + #else #define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0) @@ -42,13 +45,13 @@ extern "C" { #define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) while (0) -#endif - -#define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) \ - do { \ - OSReport("## ERROR ## [%23s]%30s@L%04d: ##ERROR## " FMT "\n", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \ +#define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) \ + do { \ + OSReport("[%23s]%30s@L%04d: ##ERROR## " FMT "\n", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \ } while (0) +#endif + void initLogging(); void deinitLogging();