COMMON: Allow for enabling/disabling debug channels by number

This commit is contained in:
Paul Gilbert 2019-11-02 19:33:00 -07:00
parent 3165d52a7b
commit d51d3d4086
2 changed files with 28 additions and 2 deletions

View file

@ -80,7 +80,7 @@ public:
void clearAllDebugChannels();
/**
* Enables an debug channel.
* Enables a debug channel.
*
* @param name the name of the debug channel to enable
* @return true on success, false on failure
@ -88,13 +88,29 @@ public:
bool enableDebugChannel(const String &name);
/**
* Disables an debug channel.
* Enables a debug channel.
*
* @param channel The debug channel
* @return true on success, false on failure
*/
bool enableDebugChannel(uint32 channel);
/**
* Disables a debug channel.
*
* @param name the name of the debug channel to disable
* @return true on success, false on failure
*/
bool disableDebugChannel(const String &name);
/**
* Disables a debug channel.
*
* @param channel The debug channel
* @return true on success, false on failure
*/
bool disableDebugChannel(uint32 channel);
typedef List<DebugChannel> DebugChannelList;
/**

View file

@ -78,6 +78,11 @@ bool DebugManager::enableDebugChannel(const String &name) {
}
}
bool DebugManager::enableDebugChannel(uint32 channel) {
gDebugChannelsEnabled |= channel;
return true;
}
bool DebugManager::disableDebugChannel(const String &name) {
DebugChannelMap::iterator i = gDebugChannels.find(name);
@ -91,6 +96,11 @@ bool DebugManager::disableDebugChannel(const String &name) {
}
}
bool DebugManager::disableDebugChannel(uint32 channel) {
gDebugChannelsEnabled &= ~channel;
return true;
}
DebugManager::DebugChannelList DebugManager::listDebugChannels() {
DebugChannelList tmp;
for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i)