diff options
Diffstat (limited to 'src/common/logging/log.h')
| -rw-r--r-- | src/common/logging/log.h | 136 |
1 files changed, 72 insertions, 64 deletions
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index c6910b1c7..a4b4750de 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -28,71 +28,73 @@ typedef u8 ClassType; | |||
| 28 | /** | 28 | /** |
| 29 | * Specifies the sub-system that generated the log message. | 29 | * Specifies the sub-system that generated the log message. |
| 30 | * | 30 | * |
| 31 | * @note If you add a new entry here, also add a corresponding one to `ALL_LOG_CLASSES` in backend.cpp. | 31 | * @note If you add a new entry here, also add a corresponding one to `ALL_LOG_CLASSES` in |
| 32 | * backend.cpp. | ||
| 32 | */ | 33 | */ |
| 33 | enum class Class : ClassType { | 34 | enum class Class : ClassType { |
| 34 | Log, ///< Messages about the log system itself | 35 | Log, ///< Messages about the log system itself |
| 35 | Common, ///< Library routines | 36 | Common, ///< Library routines |
| 36 | Common_Filesystem, ///< Filesystem interface library | 37 | Common_Filesystem, ///< Filesystem interface library |
| 37 | Common_Memory, ///< Memory mapping and management functions | 38 | Common_Memory, ///< Memory mapping and management functions |
| 38 | Core, ///< LLE emulation core | 39 | Core, ///< LLE emulation core |
| 39 | Core_ARM11, ///< ARM11 CPU core | 40 | Core_ARM11, ///< ARM11 CPU core |
| 40 | Core_Timing, ///< CoreTiming functions | 41 | Core_Timing, ///< CoreTiming functions |
| 41 | Config, ///< Emulator configuration (including commandline) | 42 | Config, ///< Emulator configuration (including commandline) |
| 42 | Debug, ///< Debugging tools | 43 | Debug, ///< Debugging tools |
| 43 | Debug_Emulated, ///< Debug messages from the emulated programs | 44 | Debug_Emulated, ///< Debug messages from the emulated programs |
| 44 | Debug_GPU, ///< GPU debugging tools | 45 | Debug_GPU, ///< GPU debugging tools |
| 45 | Debug_Breakpoint, ///< Logging breakpoints and watchpoints | 46 | Debug_Breakpoint, ///< Logging breakpoints and watchpoints |
| 46 | Debug_GDBStub, ///< GDB Stub | 47 | Debug_GDBStub, ///< GDB Stub |
| 47 | Kernel, ///< The HLE implementation of the CTR kernel | 48 | Kernel, ///< The HLE implementation of the CTR kernel |
| 48 | Kernel_SVC, ///< Kernel system calls | 49 | Kernel_SVC, ///< Kernel system calls |
| 49 | Service, ///< HLE implementation of system services. Each major service | 50 | Service, ///< HLE implementation of system services. Each major service |
| 50 | /// should have its own subclass. | 51 | /// should have its own subclass. |
| 51 | Service_SRV, ///< The SRV (Service Directory) implementation | 52 | Service_SRV, ///< The SRV (Service Directory) implementation |
| 52 | Service_FRD, ///< The FRD (Friends) service | 53 | Service_FRD, ///< The FRD (Friends) service |
| 53 | Service_FS, ///< The FS (Filesystem) service implementation | 54 | Service_FS, ///< The FS (Filesystem) service implementation |
| 54 | Service_ERR, ///< The ERR (Error) port implementation | 55 | Service_ERR, ///< The ERR (Error) port implementation |
| 55 | Service_APT, ///< The APT (Applets) service | 56 | Service_APT, ///< The APT (Applets) service |
| 56 | Service_GSP, ///< The GSP (GPU control) service | 57 | Service_GSP, ///< The GSP (GPU control) service |
| 57 | Service_AC, ///< The AC (WiFi status) service | 58 | Service_AC, ///< The AC (WiFi status) service |
| 58 | Service_AM, ///< The AM (Application manager) service | 59 | Service_AM, ///< The AM (Application manager) service |
| 59 | Service_PTM, ///< The PTM (Power status & misc.) service | 60 | Service_PTM, ///< The PTM (Power status & misc.) service |
| 60 | Service_LDR, ///< The LDR (3ds dll loader) service | 61 | Service_LDR, ///< The LDR (3ds dll loader) service |
| 61 | Service_NDM, ///< The NDM (Network daemon manager) service | 62 | Service_NDM, ///< The NDM (Network daemon manager) service |
| 62 | Service_NIM, ///< The NIM (Network interface manager) service | 63 | Service_NIM, ///< The NIM (Network interface manager) service |
| 63 | Service_NWM, ///< The NWM (Network wlan manager) service | 64 | Service_NWM, ///< The NWM (Network wlan manager) service |
| 64 | Service_CAM, ///< The CAM (Camera) service | 65 | Service_CAM, ///< The CAM (Camera) service |
| 65 | Service_CECD, ///< The CECD (StreetPass) service | 66 | Service_CECD, ///< The CECD (StreetPass) service |
| 66 | Service_CFG, ///< The CFG (Configuration) service | 67 | Service_CFG, ///< The CFG (Configuration) service |
| 67 | Service_DSP, ///< The DSP (DSP control) service | 68 | Service_DSP, ///< The DSP (DSP control) service |
| 68 | Service_DLP, ///< The DLP (Download Play) service | 69 | Service_DLP, ///< The DLP (Download Play) service |
| 69 | Service_HID, ///< The HID (Human interface device) service | 70 | Service_HID, ///< The HID (Human interface device) service |
| 70 | Service_SOC, ///< The SOC (Socket) service | 71 | Service_SOC, ///< The SOC (Socket) service |
| 71 | Service_IR, ///< The IR service | 72 | Service_IR, ///< The IR service |
| 72 | Service_Y2R, ///< The Y2R (YUV to RGB conversion) service | 73 | Service_Y2R, ///< The Y2R (YUV to RGB conversion) service |
| 73 | HW, ///< Low-level hardware emulation | 74 | HW, ///< Low-level hardware emulation |
| 74 | HW_Memory, ///< Memory-map and address translation | 75 | HW_Memory, ///< Memory-map and address translation |
| 75 | HW_LCD, ///< LCD register emulation | 76 | HW_LCD, ///< LCD register emulation |
| 76 | HW_GPU, ///< GPU control emulation | 77 | HW_GPU, ///< GPU control emulation |
| 77 | Frontend, ///< Emulator UI | 78 | Frontend, ///< Emulator UI |
| 78 | Render, ///< Emulator video output and hardware acceleration | 79 | Render, ///< Emulator video output and hardware acceleration |
| 79 | Render_Software, ///< Software renderer backend | 80 | Render_Software, ///< Software renderer backend |
| 80 | Render_OpenGL, ///< OpenGL backend | 81 | Render_OpenGL, ///< OpenGL backend |
| 81 | Audio, ///< Audio emulation | 82 | Audio, ///< Audio emulation |
| 82 | Audio_DSP, ///< The HLE implementation of the DSP | 83 | Audio_DSP, ///< The HLE implementation of the DSP |
| 83 | Audio_Sink, ///< Emulator audio output backend | 84 | Audio_Sink, ///< Emulator audio output backend |
| 84 | Loader, ///< ROM loader | 85 | Loader, ///< ROM loader |
| 85 | 86 | ||
| 86 | Count ///< Total number of logging classes | 87 | Count ///< Total number of logging classes |
| 87 | }; | 88 | }; |
| 88 | 89 | ||
| 89 | /// Logs a message to the global logger. | 90 | /// Logs a message to the global logger. |
| 90 | void LogMessage(Class log_class, Level log_level, | 91 | void LogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_nr, |
| 91 | const char* filename, unsigned int line_nr, const char* function, | 92 | const char* function, |
| 92 | #ifdef _MSC_VER | 93 | #ifdef _MSC_VER |
| 93 | _Printf_format_string_ | 94 | _Printf_format_string_ |
| 94 | #endif | 95 | #endif |
| 95 | const char* format, ...) | 96 | const char* format, |
| 97 | ...) | ||
| 96 | #ifdef __GNUC__ | 98 | #ifdef __GNUC__ |
| 97 | __attribute__((format(printf, 6, 7))) | 99 | __attribute__((format(printf, 6, 7))) |
| 98 | #endif | 100 | #endif |
| @@ -100,17 +102,23 @@ void LogMessage(Class log_class, Level log_level, | |||
| 100 | 102 | ||
| 101 | } // namespace Log | 103 | } // namespace Log |
| 102 | 104 | ||
| 103 | #define LOG_GENERIC(log_class, log_level, ...) \ | 105 | #define LOG_GENERIC(log_class, log_level, ...) \ |
| 104 | ::Log::LogMessage(log_class, log_level, __FILE__, __LINE__, __func__, __VA_ARGS__) | 106 | ::Log::LogMessage(log_class, log_level, __FILE__, __LINE__, __func__, __VA_ARGS__) |
| 105 | 107 | ||
| 106 | #ifdef _DEBUG | 108 | #ifdef _DEBUG |
| 107 | #define LOG_TRACE( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Trace, __VA_ARGS__) | 109 | #define LOG_TRACE(log_class, ...) \ |
| 110 | LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Trace, __VA_ARGS__) | ||
| 108 | #else | 111 | #else |
| 109 | #define LOG_TRACE( log_class, ...) (void(0)) | 112 | #define LOG_TRACE(log_class, ...) (void(0)) |
| 110 | #endif | 113 | #endif |
| 111 | 114 | ||
| 112 | #define LOG_DEBUG( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Debug, __VA_ARGS__) | 115 | #define LOG_DEBUG(log_class, ...) \ |
| 113 | #define LOG_INFO( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Info, __VA_ARGS__) | 116 | LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Debug, __VA_ARGS__) |
| 114 | #define LOG_WARNING( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Warning, __VA_ARGS__) | 117 | #define LOG_INFO(log_class, ...) \ |
| 115 | #define LOG_ERROR( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Error, __VA_ARGS__) | 118 | LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Info, __VA_ARGS__) |
| 116 | #define LOG_CRITICAL(log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Critical, __VA_ARGS__) | 119 | #define LOG_WARNING(log_class, ...) \ |
| 120 | LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Warning, __VA_ARGS__) | ||
| 121 | #define LOG_ERROR(log_class, ...) \ | ||
| 122 | LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Error, __VA_ARGS__) | ||
| 123 | #define LOG_CRITICAL(log_class, ...) \ | ||
| 124 | LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Critical, __VA_ARGS__) | ||