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 <charconv>
LOG_CHANNEL(cfg_log);
LOG_CHANNEL(cfg_log, "CFG");
namespace cfg
{

View File

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

View File

@ -101,9 +101,21 @@ namespace logs
// Get all registered log 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:

View File

@ -46,7 +46,7 @@
#include "Log.h"
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_rsx = 0;

View File

@ -4,7 +4,7 @@
#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)
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@
#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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,7 +32,7 @@
#include "_discord_utils.h"
#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 QVariant& _in) { return sstr(_in.toString()); }

View File

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

View File

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

View File

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