Remove legacy GENERAL log channel

Add some more log channels instead.
This commit is contained in:
Nekotekina 2020-02-01 07:15:50 +03:00
parent efafda2650
commit d9a0619ddd
26 changed files with 269 additions and 221 deletions

View file

@ -9,6 +9,8 @@
#include "windows.h"
#endif
LOG_CHANNEL(input_log);
void basic_keyboard_handler::Init(const u32 max_connect)
{
for (u32 i = 0; i < max_connect; i++)
@ -45,7 +47,7 @@ void basic_keyboard_handler::SetTargetWindow(QWindow* target)
// If this is hit, it probably means that some refactoring occurs because currently a gsframe is created in Load.
// We still want events so filter from application instead since target is null.
QApplication::instance()->installEventFilter(this);
LOG_ERROR(GENERAL, "Trying to set keyboard handler to a null target window.");
input_log.error("Trying to set keyboard handler to a null target window.");
}
}

View file

@ -3,6 +3,8 @@
#include <QApplication>
#include <QCursor>
LOG_CHANNEL(input_log);
void basic_mouse_handler::Init(const u32 max_connect)
{
m_mice.emplace_back(Mouse());
@ -37,7 +39,7 @@ void basic_mouse_handler::SetTargetWindow(QWindow* target)
// If this is hit, it probably means that some refactoring occurs because currently a gsframe is created in Load.
// We still want events so filter from application instead since target is null.
QApplication::instance()->installEventFilter(this);
LOG_ERROR(GENERAL, "Trying to set mouse handler to a null target window.");
input_log.error("Trying to set mouse handler to a null target window.");
}
}

View file

@ -17,6 +17,8 @@
#include <cstdio>
#include <cmath>
LOG_CHANNEL(evdev_log);
evdev_joystick_handler::evdev_joystick_handler() : PadHandlerBase(pad_handler::evdev)
{
init_configs();
@ -150,7 +152,7 @@ bool evdev_joystick_handler::update_device(const std::shared_ptr<PadDevice>& dev
dev = nullptr;
}
LOG_ERROR(GENERAL, "Joystick %s is not present or accessible [previous status: %d]", path.c_str(), was_connected ? 1 : 0);
evdev_log.error("Joystick %s is not present or accessible [previous status: %d]", path.c_str(), was_connected ? 1 : 0);
return false;
}
@ -161,18 +163,18 @@ bool evdev_joystick_handler::update_device(const std::shared_ptr<PadDevice>& dev
if (fd == -1)
{
int err = errno;
LOG_ERROR(GENERAL, "Failed to open joystick: %s [errno %d]", strerror(err), err);
evdev_log.error("Failed to open joystick: %s [errno %d]", strerror(err), err);
return false;
}
int ret = libevdev_new_from_fd(fd, &dev);
if (ret < 0)
{
LOG_ERROR(GENERAL, "Failed to initialize libevdev for joystick: %s [errno %d]", strerror(-ret), -ret);
evdev_log.error("Failed to initialize libevdev for joystick: %s [errno %d]", strerror(-ret), -ret);
return false;
}
LOG_NOTICE(GENERAL, "Opened joystick: '%s' at %s (fd %d)", get_device_name(dev), path, fd);
evdev_log.notice("Opened joystick: '%s' at %s (fd %d)", get_device_name(dev), path, fd);
return true;
}
@ -526,7 +528,7 @@ int evdev_joystick_handler::GetButtonInfo(const input_event& evt, const std::sha
// get the button value and return its code
if (button_list.find(code) == button_list.end())
{
LOG_ERROR(GENERAL, "Evdev button %s (%d) is unknown. Please add it to the button list.", libevdev_event_code_get_name(EV_KEY, code), code);
evdev_log.error("Evdev button %s (%d) is unknown. Please add it to the button list.", libevdev_event_code_get_name(EV_KEY, code), code);
return -1;
}
@ -583,7 +585,7 @@ std::vector<std::string> evdev_joystick_handler::ListDevices()
{
// If it's just a bad file descriptor, don't bother logging, but otherwise, log it.
if (rc != -9)
LOG_WARNING(GENERAL, "Failed to connect to device at %s, the error was: %s", "/dev/input/" + et.name, strerror(-rc));
evdev_log.warning("Failed to connect to device at %s, the error was: %s", "/dev/input/" + et.name, strerror(-rc));
libevdev_free(dev);
close(fd);
continue;
@ -631,7 +633,7 @@ int evdev_joystick_handler::add_device(const std::string& device, const std::sha
{
// If it's just a bad file descriptor, don't bother logging, but otherwise, log it.
if (rc != -9)
LOG_WARNING(GENERAL, "Failed to connect to device at %s, the error was: %s", path, strerror(-rc));
evdev_log.warning("Failed to connect to device at %s, the error was: %s", path, strerror(-rc));
libevdev_free(dev);
close(fd);
continue;
@ -712,7 +714,7 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
// Grab any pending sync event.
if (ret == LIBEVDEV_READ_STATUS_SYNC)
{
LOG_NOTICE(GENERAL, "Captured sync event");
evdev_log.notice("Captured sync event");
ret = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_NORMAL | LIBEVDEV_READ_FLAG_SYNC, &evt);
}
@ -720,7 +722,7 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
{
// -EAGAIN signifies no available events, not an actual *error*.
if (ret != -EAGAIN)
LOG_ERROR(GENERAL, "Failed to read latest event from joystick: %s [errno %d]", strerror(-ret), -ret);
evdev_log.error("Failed to read latest event from joystick: %s [errno %d]", strerror(-ret), -ret);
return;
}

View file

@ -3,6 +3,8 @@
#include <QApplication>
#include <QThread>
LOG_CHANNEL(input_log);
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
constexpr auto qstr = QString::fromStdString;
@ -179,7 +181,7 @@ void keyboard_pad_handler::SetTargetWindow(QWindow* target)
QApplication::instance()->installEventFilter(this);
// If this is hit, it probably means that some refactoring occurs because currently a gsframe is created in Load.
// We still want events so filter from application instead since target is null.
LOG_ERROR(GENERAL, "Trying to set pad handler to a null target window.");
input_log.error("Trying to set pad handler to a null target window.");
}
}
@ -250,42 +252,42 @@ void keyboard_pad_handler::keyPressEvent(QKeyEvent* event)
{
case Qt::Key_I:
m_deadzone_y = std::min(m_deadzone_y + 1, 255);
LOG_SUCCESS(GENERAL, "mouse move adjustment: deadzone y = %d", m_deadzone_y);
input_log.success("mouse move adjustment: deadzone y = %d", m_deadzone_y);
event->ignore();
return;
case Qt::Key_U:
m_deadzone_y = std::max(0, m_deadzone_y - 1);
LOG_SUCCESS(GENERAL, "mouse move adjustment: deadzone y = %d", m_deadzone_y);
input_log.success("mouse move adjustment: deadzone y = %d", m_deadzone_y);
event->ignore();
return;
case Qt::Key_Y:
m_deadzone_x = std::min(m_deadzone_x + 1, 255);
LOG_SUCCESS(GENERAL, "mouse move adjustment: deadzone x = %d", m_deadzone_x);
input_log.success("mouse move adjustment: deadzone x = %d", m_deadzone_x);
event->ignore();
return;
case Qt::Key_T:
m_deadzone_x = std::max(0, m_deadzone_x - 1);
LOG_SUCCESS(GENERAL, "mouse move adjustment: deadzone x = %d", m_deadzone_x);
input_log.success("mouse move adjustment: deadzone x = %d", m_deadzone_x);
event->ignore();
return;
case Qt::Key_K:
m_multi_y = std::min(m_multi_y + 0.1, 5.0);
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %d", static_cast<int>(m_multi_y * 100));
input_log.success("mouse move adjustment: multiplier y = %d", static_cast<int>(m_multi_y * 100));
event->ignore();
return;
case Qt::Key_J:
m_multi_y = std::max(0.0, m_multi_y - 0.1);
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %d", static_cast<int>(m_multi_y * 100));
input_log.success("mouse move adjustment: multiplier y = %d", static_cast<int>(m_multi_y * 100));
event->ignore();
return;
case Qt::Key_H:
m_multi_x = std::min(m_multi_x + 0.1, 5.0);
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %d", static_cast<int>(m_multi_x * 100));
input_log.success("mouse move adjustment: multiplier x = %d", static_cast<int>(m_multi_x * 100));
event->ignore();
return;
case Qt::Key_G:
m_multi_x = std::max(0.0, m_multi_x - 0.1);
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %d", static_cast<int>(m_multi_x * 100));
input_log.success("mouse move adjustment: multiplier x = %d", static_cast<int>(m_multi_x * 100));
event->ignore();
return;
default:
@ -550,7 +552,7 @@ u32 keyboard_pad_handler::GetKeyCode(const QString& keyName)
if (seq.count() == 1)
keyCode = seq[0];
else
LOG_NOTICE(GENERAL, "GetKeyCode(%s): seq.count() = %d", sstr(keyName), seq.count());
input_log.notice("GetKeyCode(%s): seq.count() = %d", sstr(keyName), seq.count());
return keyCode;
}

View file

@ -1,6 +1,8 @@
#ifdef _WIN32
#include "mm_joystick_handler.h"
LOG_CHANNEL(input_log);
mm_joystick_handler::mm_joystick_handler() : PadHandlerBase(pad_handler::mm)
{
init_configs();
@ -81,11 +83,11 @@ bool mm_joystick_handler::Init()
if (supported_joysticks <= 0)
{
LOG_ERROR(GENERAL, "mmjoy: Driver doesn't support Joysticks");
input_log.error("mmjoy: Driver doesn't support Joysticks");
return false;
}
LOG_NOTICE(GENERAL, "mmjoy: Driver supports %u joysticks", supported_joysticks);
input_log.notice("mmjoy: Driver supports %u joysticks", supported_joysticks);
for (u32 i = 0; i < supported_joysticks; i++)
{
@ -191,7 +193,7 @@ void mm_joystick_handler::get_next_button_press(const std::string& padId, const
id = GetIDByName(padId);
if (id < 0)
{
LOG_ERROR(GENERAL, "MMJOY get_next_button_press for device [%s] failed with id = %d", padId, id);
input_log.error("MMJOY get_next_button_press for device [%s] failed with id = %d", padId, id);
return fail_callback(padId);
}
}
@ -447,7 +449,7 @@ bool mm_joystick_handler::GetMMJOYDevice(int index, MMJOYDevice* dev)
char drv[32];
wcstombs(drv, js_caps.szPname, 31);
LOG_NOTICE(GENERAL, "Joystick nr.%d found. Driver: %s", index, drv);
input_log.notice("Joystick nr.%d found. Driver: %s", index, drv);
dev->device_id = index;
dev->device_name = m_name_string + std::to_string(index + 1); // Controllers 1-n in GUI

View file

@ -10,6 +10,8 @@
#include "keyboard_pad_handler.h"
#include "Emu/Io/Null/NullPadHandler.h"
LOG_CHANNEL(input_log);
namespace pad
{
atomic_t<pad_thread*> g_current = nullptr;
@ -123,7 +125,7 @@ void pad_thread::Init()
if (cur_pad_handler->bindPadToDevice(m_pads[i], g_cfg_input.player[i]->device.to_string()) == false)
{
// Failed to bind the device to cur_pad_handler so binds to NullPadHandler
LOG_ERROR(GENERAL, "Failed to bind device %s to handler %s", g_cfg_input.player[i]->device.to_string(), handler_type.to_string());
input_log.error("Failed to bind device %s to handler %s", g_cfg_input.player[i]->device.to_string(), handler_type.to_string());
nullpad->bindPadToDevice(m_pads[i], g_cfg_input.player[i]->device.to_string());
}
}