1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Give log channels fancier names

Improve LOG_CHANNEL macro to accept custom name.
This commit is contained in:
Nekotekina 2020-02-01 10:43:43 +03:00
parent ec80932c21
commit 3c0bd821c8
33 changed files with 46 additions and 34 deletions

View File

@ -6,7 +6,7 @@
#include <typeinfo> #include <typeinfo>
#include <charconv> #include <charconv>
LOG_CHANNEL(cfg_log); LOG_CHANNEL(cfg_log, "CFG");
namespace cfg namespace cfg
{ {

View File

@ -14,7 +14,7 @@
#define CAN_OVERCOMMIT #define CAN_OVERCOMMIT
#endif #endif
LOG_CHANNEL(jit_log); LOG_CHANNEL(jit_log, "JIT");
static u8* get_jit_memory() static u8* get_jit_memory()
{ {

View File

@ -101,9 +101,21 @@ namespace logs
// Get all registered log channels // Get all registered log channels
std::vector<std::string> get_channels(); std::vector<std::string> get_channels();
// Helper: no additional name specified
constexpr const char* make_channel_name(const char* name)
{
return name;
}
// Helper: special channel name specified
constexpr const char* make_channel_name(const char*, const char* name, ...)
{
return name;
}
} }
#define LOG_CHANNEL(ch) inline ::logs::channel ch(#ch) #define LOG_CHANNEL(ch, ...) inline ::logs::channel ch(::logs::make_channel_name(#ch, ##__VA_ARGS__))
// Legacy: // Legacy:

View File

@ -46,7 +46,7 @@
#include "Log.h" #include "Log.h"
LOG_CHANNEL(sig_log); LOG_CHANNEL(sig_log);
LOG_CHANNEL(vm_log); LOG_CHANNEL(vm_log, "VM");
thread_local u64 g_tls_fault_all = 0; thread_local u64 g_tls_fault_all = 0;
thread_local u64 g_tls_fault_rsx = 0; thread_local u64 g_tls_fault_rsx = 0;

View File

@ -4,7 +4,7 @@
#include <cmath> #include <cmath>
LOG_CHANNEL(edat_log); LOG_CHANNEL(edat_log, "EDAT");
void generate_key(int crypto_mode, int version, unsigned char *key_final, unsigned char *iv_final, unsigned char *key, unsigned char *iv) void generate_key(int crypto_mode, int version, unsigned char *key_final, unsigned char *iv_final, unsigned char *key, unsigned char *iv)
{ {

View File

@ -8,7 +8,7 @@
#include "Emu/VFS.h" #include "Emu/VFS.h"
#include "unpkg.h" #include "unpkg.h"
LOG_CHANNEL(pkg_log); LOG_CHANNEL(pkg_log, "PKG");
bool pkg_install(const std::string& path, atomic_t<double>& sync) bool pkg_install(const std::string& path, atomic_t<double>& sync)
{ {

View File

@ -7,7 +7,7 @@
#include "Utilities/File.h" #include "Utilities/File.h"
#include "Utilities/Log.h" #include "Utilities/Log.h"
LOG_CHANNEL(self_log); LOG_CHANNEL(self_log, "SELF");
struct AppInfo struct AppInfo
{ {

View File

@ -16,7 +16,7 @@ DECLARE(cpu_thread::g_threads_created){0};
DECLARE(cpu_thread::g_threads_deleted){0}; DECLARE(cpu_thread::g_threads_deleted){0};
LOG_CHANNEL(profiler); LOG_CHANNEL(profiler);
LOG_CHANNEL(sys_log); LOG_CHANNEL(sys_log, "SYS");
template <> template <>
void fmt_class_string<cpu_flag>::format(std::string& out, u64 arg) void fmt_class_string<cpu_flag>::format(std::string& out, u64 arg)

View File

@ -2,7 +2,7 @@
#include "Skylander.h" #include "Skylander.h"
#include "Emu/Cell/lv2/sys_usbd.h" #include "Emu/Cell/lv2/sys_usbd.h"
LOG_CHANNEL(skylander_log); LOG_CHANNEL(skylander_log, "skylander");
sky_portal g_skylander; sky_portal g_skylander;

View File

@ -17,7 +17,7 @@
#include <thread> #include <thread>
#include <deque> #include <deque>
LOG_CHANNEL(vm_log); LOG_CHANNEL(vm_log, "VM");
namespace vm namespace vm
{ {

View File

@ -48,7 +48,7 @@
#include "Emu/RSX/VK/VulkanAPI.h" #include "Emu/RSX/VK/VulkanAPI.h"
#endif #endif
LOG_CHANNEL(sys_log); LOG_CHANNEL(sys_log, "SYS");
stx::manual_fixed_typemap<void> g_fixed_typemap; stx::manual_fixed_typemap<void> g_fixed_typemap;

View File

@ -9,7 +9,7 @@
#include "windows.h" #include "windows.h"
#endif #endif
LOG_CHANNEL(input_log); LOG_CHANNEL(input_log, "Input");
void basic_keyboard_handler::Init(const u32 max_connect) void basic_keyboard_handler::Init(const u32 max_connect)
{ {

View File

@ -3,7 +3,7 @@
#include <QApplication> #include <QApplication>
#include <QCursor> #include <QCursor>
LOG_CHANNEL(input_log); LOG_CHANNEL(input_log, "Input");
void basic_mouse_handler::Init(const u32 max_connect) void basic_mouse_handler::Init(const u32 max_connect)
{ {

View File

@ -17,7 +17,7 @@
#include <cstdio> #include <cstdio>
#include <cmath> #include <cmath>
LOG_CHANNEL(evdev_log); LOG_CHANNEL(evdev_log, "evdev");
evdev_joystick_handler::evdev_joystick_handler() : PadHandlerBase(pad_handler::evdev) evdev_joystick_handler::evdev_joystick_handler() : PadHandlerBase(pad_handler::evdev)
{ {

View File

@ -3,7 +3,7 @@
#include <QApplication> #include <QApplication>
#include <QThread> #include <QThread>
LOG_CHANNEL(input_log); LOG_CHANNEL(input_log, "Input");
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }
constexpr auto qstr = QString::fromStdString; constexpr auto qstr = QString::fromStdString;

View File

@ -1,7 +1,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include "mm_joystick_handler.h" #include "mm_joystick_handler.h"
LOG_CHANNEL(input_log); LOG_CHANNEL(input_log, "Input");
mm_joystick_handler::mm_joystick_handler() : PadHandlerBase(pad_handler::mm) mm_joystick_handler::mm_joystick_handler() : PadHandlerBase(pad_handler::mm)
{ {

View File

@ -10,7 +10,7 @@
#include "keyboard_pad_handler.h" #include "keyboard_pad_handler.h"
#include "Emu/Io/Null/NullPadHandler.h" #include "Emu/Io/Null/NullPadHandler.h"
LOG_CHANNEL(input_log); LOG_CHANNEL(input_log, "Input");
namespace pad namespace pad
{ {

View File

@ -1,7 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "PSF.h" #include "PSF.h"
LOG_CHANNEL(psf_log); LOG_CHANNEL(psf_log, "PSF");
template<> template<>
void fmt_class_string<psf::format>::format(std::string& out, u64 arg) void fmt_class_string<psf::format>::format(std::string& out, u64 arg)

View File

@ -5,7 +5,7 @@
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>
LOG_CHANNEL(tar_log); LOG_CHANNEL(tar_log, "TAR");
tar_object::tar_object(const fs::file& file, size_t offset) tar_object::tar_object(const fs::file& file, size_t offset)
: m_file(file) : m_file(file)

View File

@ -5,7 +5,7 @@
#include "Emu/System.h" #include "Emu/System.h"
#include "TROPUSR.h" #include "TROPUSR.h"
LOG_CHANNEL(trp_log); LOG_CHANNEL(trp_log, "Trophy");
bool TROPUSRLoader::Load(const std::string& filepath, const std::string& configpath) bool TROPUSRLoader::Load(const std::string& filepath, const std::string& configpath)
{ {

View File

@ -16,7 +16,7 @@
#include "Emu/RSX/CgBinaryProgram.h" #include "Emu/RSX/CgBinaryProgram.h"
LOG_CHANNEL(gui_log); LOG_CHANNEL(gui_log, "GUI");
constexpr auto qstr = QString::fromStdString; constexpr auto qstr = QString::fromStdString;
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }

View File

@ -19,7 +19,7 @@
#include "3rdparty/OpenAL/include/alext.h" #include "3rdparty/OpenAL/include/alext.h"
LOG_CHANNEL(cfg_log); LOG_CHANNEL(cfg_log, "CFG");
extern std::string g_cfg_defaults; //! Default settings grabbed from Utilities/Config.h extern std::string g_cfg_defaults; //! Default settings grabbed from Utilities/Config.h

View File

@ -29,8 +29,8 @@
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
LOG_CHANNEL(game_list_log); LOG_CHANNEL(game_list_log, "GameList");
LOG_CHANNEL(sys_log); LOG_CHANNEL(sys_log, "SYS");
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }

View File

@ -18,7 +18,7 @@
#include <clocale> #include <clocale>
LOG_CHANNEL(gui_log); LOG_CHANNEL(gui_log, "GUI");
gui_application::gui_application(int& argc, char** argv) : QApplication(argc, argv) gui_application::gui_application(int& argc, char** argv) : QApplication(argc, argv)
{ {

View File

@ -6,7 +6,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QMessageBox> #include <QMessageBox>
LOG_CHANNEL(cfg_log); LOG_CHANNEL(cfg_log, "CFG");
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }

View File

@ -55,7 +55,7 @@
#include "ui_main_window.h" #include "ui_main_window.h"
LOG_CHANNEL(gui_log); LOG_CHANNEL(gui_log, "GUI");
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }

View File

@ -2,7 +2,7 @@
#include <QLabel> #include <QLabel>
LOG_CHANNEL(gui_log); LOG_CHANNEL(gui_log, "GUI");
memory_string_searcher::memory_string_searcher(QWidget* parent) memory_string_searcher::memory_string_searcher(QWidget* parent)
: QDialog(parent) : QDialog(parent)

View File

@ -24,7 +24,7 @@
#include "Input/evdev_joystick_handler.h" #include "Input/evdev_joystick_handler.h"
#endif #endif
LOG_CHANNEL(cfg_log); LOG_CHANNEL(cfg_log, "CFG");
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }
constexpr auto qstr = QString::fromStdString; constexpr auto qstr = QString::fromStdString;

View File

@ -22,7 +22,7 @@
#include <QPainter> #include <QPainter>
#include <QScreen> #include <QScreen>
LOG_CHANNEL(gui_log); LOG_CHANNEL(gui_log, "GUI");
namespace namespace
{ {

View File

@ -32,7 +32,7 @@
#include "_discord_utils.h" #include "_discord_utils.h"
#endif #endif
LOG_CHANNEL(cfg_log); LOG_CHANNEL(cfg_log, "CFG");
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }
inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); } inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); }

View File

@ -35,7 +35,7 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QScreen> #include <QScreen>
LOG_CHANNEL(gui_log); LOG_CHANNEL(gui_log, "GUI");
namespace namespace
{ {

View File

@ -1,6 +1,6 @@
#include "user_account.h" #include "user_account.h"
LOG_CHANNEL(gui_log); LOG_CHANNEL(gui_log, "GUI");
UserAccount::UserAccount(const std::string& user_id) UserAccount::UserAccount(const std::string& user_id)
{ {

View File

@ -15,7 +15,7 @@
#include <QScreen> #include <QScreen>
#include <QKeyEvent> #include <QKeyEvent>
LOG_CHANNEL(gui_log); LOG_CHANNEL(gui_log, "GUI");
namespace namespace
{ {