Skip to content

Commit

Permalink
remove ControllerDebug
Browse files Browse the repository at this point in the history
It has been replaced by categorized logging.
  • Loading branch information
Be-ing committed Aug 24, 2021
1 parent 8fcc1dd commit ac77958
Show file tree
Hide file tree
Showing 19 changed files with 16 additions and 143 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/control/controlpushbutton.cpp
src/control/controlttrotary.cpp
src/controllers/controller.cpp
src/controllers/controllerdebug.cpp
src/controllers/controllerenumerator.cpp
src/controllers/controllerinputmappingtablemodel.cpp
src/controllers/controllerlearningeventfilter.cpp
Expand Down
11 changes: 0 additions & 11 deletions packaging/debian/mixxx.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,6 @@ manpage.1: manpage.sgml
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--controllerDebug/--midiDebug</option>
</term>
<listitem>
<para>
Causes Mixxx to display/log all of the MIDI/HID controller data
it receives and script functions it loads.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--developer</option>
Expand Down
3 changes: 1 addition & 2 deletions src/control/controlobjectscript.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include "control/controlobjectscript.h"

#include "controllers/controllerdebug.h"
#include "moc_controlobjectscript.cpp"

ControlObjectScript::ControlObjectScript(
const ConfigKey& key, const RuntimeLoggingCategory& logger, QObject* pParent)
: ControlProxy(key, pParent, ControllerDebug::controlFlags()),
: ControlProxy(key, pParent, ControlFlag::AllowMissingOrInvalid),
m_logger(logger) {
}

Expand Down
1 change: 0 additions & 1 deletion src/controllers/bulk/bulkcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <libusb.h>

#include "controllers/bulk/bulksupported.h"
#include "controllers/controllerdebug.h"
#include "controllers/defs_controllers.h"
#include "moc_bulkcontroller.cpp"
#include "util/compatibility.h"
Expand Down
1 change: 0 additions & 1 deletion src/controllers/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <QJSValue>
#include <QRegularExpression>

#include "controllers/controllerdebug.h"
#include "controllers/defs_controllers.h"
#include "moc_controller.cpp"
#include "util/screensaver.h"
Expand Down
13 changes: 0 additions & 13 deletions src/controllers/controllerdebug.cpp

This file was deleted.

61 changes: 0 additions & 61 deletions src/controllers/controllerdebug.h

This file was deleted.

3 changes: 1 addition & 2 deletions src/controllers/hid/hidcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <hidapi.h>

#include "controllers/controllerdebug.h"
#include "controllers/defs_controllers.h"
#include "controllers/hid/legacyhidcontrollermappingfilehandler.h"
#include "moc_hidcontroller.cpp"
Expand Down Expand Up @@ -159,7 +158,7 @@ void HidController::processInputReport(int bytesRead) {
reinterpret_cast<char*>(pCurrentBuffer), bytesRead);

// Execute callback function in JavaScript mapping
// and print to stdout in case of --controllerDebug
// and log incoming data
receive(incomingData, mixxx::Time::elapsed());
}

Expand Down
1 change: 0 additions & 1 deletion src/controllers/midi/hss1394controller.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "controllers/midi/hss1394controller.h"

#include "controllers/controllerdebug.h"
#include "controllers/midi/midiutils.h"
#include "moc_hss1394controller.cpp"
#include "util/time.h"
Expand Down
1 change: 0 additions & 1 deletion src/controllers/midi/midicontroller.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "controllers/midi/midicontroller.h"

#include "control/controlobject.h"
#include "controllers/controllerdebug.h"
#include "controllers/defs_controllers.h"
#include "controllers/midi/midiutils.h"
#include "defs_urls.h"
Expand Down
1 change: 0 additions & 1 deletion src/controllers/midi/midioutputhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <QtDebug>

#include "control/controlobject.h"
#include "controllers/controllerdebug.h"
#include "controllers/midi/midicontroller.h"
#include "moc_midioutputhandler.cpp"

Expand Down
1 change: 0 additions & 1 deletion src/controllers/midi/portmidicontroller.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "controllers/midi/portmidicontroller.h"

#include "controllers/controllerdebug.h"
#include "controllers/midi/midiutils.h"
#include "moc_portmidicontroller.cpp"

Expand Down
1 change: 0 additions & 1 deletion src/controllers/scripting/controllerscriptenginebase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "control/controlobject.h"
#include "controllers/controller.h"
#include "controllers/controllerdebug.h"
#include "controllers/scripting/colormapperjsproxy.h"
#include "errordialoghandler.h"
#include "mixer/playermanager.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "control/controlobject.h"
#include "controllers/controller.h"
#include "controllers/controllerdebug.h"
#include "controllers/scripting/colormapperjsproxy.h"
#include "controllers/scripting/legacy/controllerscriptinterfacelegacy.h"
#include "errordialoghandler.h"
Expand Down Expand Up @@ -150,7 +149,7 @@ bool ControllerScriptEngineLegacy::initialize() {
} else { // m_pController is nullptr in tests.
args << QJSValue();
}
args << QJSValue(ControllerDebug::isEnabled());
args << QJSValue(m_logger().isDebugEnabled());
if (!callFunctionOnObjects(m_scriptFunctionPrefixes, "init", args, true)) {
shutdown();
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "control/controlobject.h"
#include "control/controlobjectscript.h"
#include "controllers/controllerdebug.h"
#include "controllers/scripting/legacy/controllerscriptenginelegacy.h"
#include "controllers/scripting/legacy/scriptconnectionjsproxy.h"
#include "mixer/playermanager.h"
Expand Down Expand Up @@ -123,7 +122,7 @@ void ControllerScriptInterfaceLegacy::setValue(

if (coScript != nullptr) {
ControlObject* pControl = ControlObject::getControl(
coScript->getKey(), ControllerDebug::controlFlags());
coScript->getKey(), ControlFlag::AllowMissingOrInvalid);
if (pControl &&
!m_st.ignore(
pControl, coScript->getParameterForValue(newValue))) {
Expand Down Expand Up @@ -154,7 +153,7 @@ void ControllerScriptInterfaceLegacy::setParameter(

if (coScript != nullptr) {
ControlObject* pControl = ControlObject::getControl(
coScript->getKey(), ControllerDebug::controlFlags());
coScript->getKey(), ControlFlag::AllowMissingOrInvalid);
if (pControl && !m_st.ignore(pControl, newParameter)) {
coScript->setParameter(newParameter);
}
Expand Down Expand Up @@ -501,7 +500,7 @@ void ControllerScriptInterfaceLegacy::timerEvent(QTimerEvent* event) {
void ControllerScriptInterfaceLegacy::softTakeover(
const QString& group, const QString& name, bool set) {
ControlObject* pControl = ControlObject::getControl(
ConfigKey(group, name), ControllerDebug::controlFlags());
ConfigKey(group, name), ControlFlag::AllowMissingOrInvalid);
if (!pControl) {
return;
}
Expand All @@ -515,7 +514,7 @@ void ControllerScriptInterfaceLegacy::softTakeover(
void ControllerScriptInterfaceLegacy::softTakeoverIgnoreNextValue(
const QString& group, const QString& name) {
ControlObject* pControl = ControlObject::getControl(
ConfigKey(group, name), ControllerDebug::controlFlags());
ConfigKey(group, name), ControlFlag::AllowMissingOrInvalid);
if (!pControl) {
return;
}
Expand Down
14 changes: 0 additions & 14 deletions src/test/controllerscriptenginelegacy_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "control/controlobject.h"
#include "control/controlpotmeter.h"
#include "controllers/controllerdebug.h"
#include "controllers/softtakeover.h"
#include "preferences/usersettings.h"
#include "test/mixxxtest.h"
Expand Down Expand Up @@ -36,7 +35,6 @@ class ControllerScriptEngineLegacyTest : public MixxxTest {
QThread::currentThread()->setObjectName("Main");
cEngine = new ControllerScriptEngineLegacy(nullptr, logger);
cEngine->initialize();
ControllerDebug::setTesting(true);
}

void TearDown() override {
Expand Down Expand Up @@ -82,29 +80,17 @@ TEST_F(ControllerScriptEngineLegacyTest, setValue) {
}

TEST_F(ControllerScriptEngineLegacyTest, getValue_InvalidKey) {
ControllerDebug::setEnabled(false);
ControllerDebug::setTesting(false);
EXPECT_TRUE(evaluateAndAssert("engine.getValue('', '');"));
EXPECT_TRUE(evaluateAndAssert("engine.getValue('', 'invalid');"));
EXPECT_TRUE(evaluateAndAssert("engine.getValue('[Invalid]', '');"));
ControllerDebug::setTesting(true);
ControllerDebug::setEnabled(true);
}

TEST_F(ControllerScriptEngineLegacyTest, setValue_InvalidControl) {
ControllerDebug::setEnabled(false);
ControllerDebug::setTesting(false);
EXPECT_TRUE(evaluateAndAssert("engine.setValue('[Nothing]', 'nothing', 1.0);"));
ControllerDebug::setTesting(true);
ControllerDebug::setEnabled(true);
}

TEST_F(ControllerScriptEngineLegacyTest, getValue_InvalidControl) {
ControllerDebug::setEnabled(false);
ControllerDebug::setTesting(false);
EXPECT_TRUE(evaluateAndAssert("engine.getValue('[Nothing]', 'nothing');"));
ControllerDebug::setTesting(true);
ControllerDebug::setEnabled(true);
}

TEST_F(ControllerScriptEngineLegacyTest, setValue_IgnoresNaN) {
Expand Down
14 changes: 0 additions & 14 deletions src/util/cmdlineargs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

CmdlineArgs::CmdlineArgs()
: m_startInFullscreen(false), // Initialize vars
m_midiDebug(false),
m_developer(false),
m_safeMode(false),
m_debugAssertBreak(false),
Expand Down Expand Up @@ -169,18 +168,6 @@ bool CmdlineArgs::parse(const QStringList& arguments, CmdlineArgs::ParseMode mod
parser.addOption(timelinePath);
parser.addOption(timelinePathDeprecated);

const QCommandLineOption controllerDebug(QStringLiteral("controller-debug"),
forUserFeedback ? QCoreApplication::translate("CmdlineArgs",
"Causes Mixxx to display/log all of the controller data it "
"receives and script functions it loads")
: QString());
QCommandLineOption controllerDebugDeprecated(
QStringList({QStringLiteral("controllerDebug"),
QStringLiteral("midiDebug")}));
controllerDebugDeprecated.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(controllerDebug);
parser.addOption(controllerDebugDeprecated);

const QCommandLineOption developer(QStringLiteral("developer"),
forUserFeedback ? QCoreApplication::translate("CmdlineArgs",
"Enables developer-mode. Includes extra log info, stats on "
Expand Down Expand Up @@ -318,7 +305,6 @@ bool CmdlineArgs::parse(const QStringList& arguments, CmdlineArgs::ParseMode mod
m_timelinePath = parser.value(timelinePathDeprecated);
}

m_midiDebug = parser.isSet(controllerDebug) || parser.isSet(controllerDebugDeprecated);
m_developer = parser.isSet(developer);
m_safeMode = parser.isSet(safeMode) || parser.isSet(safeModeDeprecated);
m_debugAssertBreak = parser.isSet(debugAssertBreak) || parser.isSet(debugAssertBreakDeprecated);
Expand Down
2 changes: 0 additions & 2 deletions src/util/cmdlineargs.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class CmdlineArgs final {

const QList<QString>& getMusicFiles() const { return m_musicFiles; }
bool getStartInFullscreen() const { return m_startInFullscreen; }
bool getMidiDebug() const { return m_midiDebug; }
bool getDeveloper() const { return m_developer; }
bool getSafeMode() const { return m_safeMode; }
bool useColors() const {
Expand Down Expand Up @@ -60,7 +59,6 @@ class CmdlineArgs final {

QList<QString> m_musicFiles; // List of files to load into players at startup
bool m_startInFullscreen; // Start in fullscreen mode
bool m_midiDebug;
bool m_developer; // Developer Mode
bool m_safeMode;
bool m_debugAssertBreak;
Expand Down
18 changes: 9 additions & 9 deletions src/util/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <QTextStream>
#include <QThread>

#include "controllers/controllerdebug.h"
#include "util/assert.h"
#include "util/cmdlineargs.h"

Expand Down Expand Up @@ -245,15 +244,11 @@ void handleMessage(
const char* levelName = nullptr;
WriteFlags writeFlags = WriteFlag::None;
bool isDebugAssert = false;
bool isControllerDebug = false;
const QString categoryName(context.category);
switch (type) {
case QtDebugMsg:
levelName = "Debug";
isControllerDebug =
input.startsWith(QLatin1String(
ControllerDebug::kLogMessagePrefix));
if (isControllerDebug ||
Logging::enabled(LogLevel::Debug)) {
if (Logging::enabled(LogLevel::Debug)) {
writeFlags |= WriteFlag::StdErr;
writeFlags |= WriteFlag::File;
}
Expand All @@ -263,8 +258,13 @@ void handleMessage(
// TODO: Remove the following line.
// Do not write debug log messages into log file if log level
// Debug is not enabled starting with release 2.4.0! Until then
// write debug messages unconditionally into the log file
writeFlags |= WriteFlag::File;
// write debug messages into the log file, but skip controller I/O
// to avoid flooding the log file.
if (!(categoryName.startsWith("controller") &&
(categoryName.endsWith("input") ||
categoryName.endsWith("output")))) {
writeFlags |= WriteFlag::File;
}
break;
case QtInfoMsg:
levelName = "Info";
Expand Down

0 comments on commit ac77958

Please sign in to comment.