mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 02:40:14 +00:00
Key control: shortcut to control repeating of msgs
This commit is contained in:
@@ -258,5 +258,5 @@ void Logger::preinit(bool skip_repeated)
|
||||
}
|
||||
|
||||
std::atomic<Logger::last_message *> Logger::last_msg{};
|
||||
bool Logger::skip_repeated = true;
|
||||
std::atomic<bool> Logger::skip_repeated{true};
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ bool set_log_level(const char *optarg, bool *logger_repeat_msgs);
|
||||
#include "compat/platform_time.h"
|
||||
#include "rang.hpp"
|
||||
|
||||
class keyboard_control; // friend
|
||||
|
||||
// Log, version 0.1: a simple logging class
|
||||
class Logger
|
||||
{
|
||||
@@ -145,12 +147,14 @@ private:
|
||||
int level;
|
||||
std::ostringstream oss;
|
||||
|
||||
static bool skip_repeated;
|
||||
static std::atomic<bool> skip_repeated;
|
||||
struct last_message {
|
||||
std::string msg;
|
||||
int count{0};
|
||||
};
|
||||
static std::atomic<last_message *> last_msg; // leaks last message upon exit
|
||||
|
||||
friend class keyboard_control;
|
||||
};
|
||||
|
||||
#define LOG(level) \
|
||||
|
||||
@@ -121,7 +121,7 @@ keyboard_control::keyboard_control(struct module *parent) :
|
||||
m_should_exit(false),
|
||||
m_started(false),
|
||||
m_locked_against_changes(true),
|
||||
guarded_keys { '*', '/', '9', '0', 'c', 'C', 'm', 'M', '>', '<', 'e', 's', 'S', 'v', 'V' }
|
||||
guarded_keys { '*', '/', '9', '0', 'c', 'C', 'm', 'M', '>', '<', 'e', 's', 'S', 'v', 'V', 'r' }
|
||||
{
|
||||
m_start_time = time(NULL);
|
||||
|
||||
@@ -540,6 +540,10 @@ void keyboard_control::run()
|
||||
cout << "Log level: " << log_level << "\n";
|
||||
break;
|
||||
}
|
||||
case 'r':
|
||||
Logger::skip_repeated = !Logger::skip_repeated;
|
||||
cout << "Skip repeated messages: " << std::boolalpha << Logger::skip_repeated << std::noboolalpha << "\n";
|
||||
break;
|
||||
case 's':
|
||||
if (saved_log_level == -1) {
|
||||
saved_log_level = log_level;
|
||||
@@ -672,6 +676,7 @@ void keyboard_control::usage()
|
||||
BOLD("\t M ") << "- mute/unmute sender" << G('M') << "\n" <<
|
||||
BOLD("\t v ") << "- increase verbosity level" << G('v') << "\n" <<
|
||||
BOLD("\t V ") << "- decrease verbosity level" << G('V') << "\n" <<
|
||||
BOLD("\t r ") << "- skip repeated messages (toggle) " << G('r') << "\n" <<
|
||||
BOLD("\t e ") << "- record captured content (toggle)" << G('e') << "\n" <<
|
||||
BOLD("\t h ") << "- show help" << G('h') << "\n" <<
|
||||
BOLD("\t i ") << "- show various information" << G('i') << "\n" <<
|
||||
|
||||
Reference in New Issue
Block a user