2022-12-07 Fred Gleason <fredg@paravelsystems.com>

* Added a 'LogSearchStrings=' directive to the '[Debugging]'
	section of rd.conf(5).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-12-07 12:38:16 -05:00
parent ba9e995e8f
commit cd5637dec3
5 changed files with 84 additions and 0 deletions

View File

@ -23761,3 +23761,6 @@
fail to appear in the 'Ext Data' column of the 'Edit Log' dialog. fail to appear in the 'Ext Data' column of the 'Edit Log' dialog.
2022-12-06 Fred Gleason <fredg@paravelsystems.com> 2022-12-06 Fred Gleason <fredg@paravelsystems.com>
* Incremented the package version to 4.0.0rc0int5. * Incremented the package version to 4.0.0rc0int5.
2022-12-07 Fred Gleason <fredg@paravelsystems.com>
* Added a 'LogSearchStrings=' directive to the '[Debugging]'
section of rd.conf(5).

View File

@ -207,3 +207,11 @@ TranscodingDelay=0
; Suppress meter update messages on the notification multicast channel. ; Suppress meter update messages on the notification multicast channel.
; ;
;SuppressRdcatchMeterUpdates=No ;SuppressRdcatchMeterUpdates=No
[Debugging]
; Log all filter search strings to the syslog, at the specified priority level.
; See the 'level' parameter in the syslog(3) man page for the set of available
; priority levels. An empty argument disables logging.
;
; LogSearchStrings=LOG_DEBUG
LogSearchStrings=

View File

@ -740,6 +740,12 @@ void RDCartFilter::UpdateModel()
if((filterSql()!=d_model_filter_sql)||(cartLimit()!=d_model_cart_limit)) { if((filterSql()!=d_model_filter_sql)||(cartLimit()!=d_model_cart_limit)) {
d_model_filter_sql=filterSql(); d_model_filter_sql=filterSql();
d_model_cart_limit=cartLimit(); d_model_cart_limit=cartLimit();
if(rda->config()->logSearchStrings()) {
rda->syslog(rda->config()->logSearchStringsLevel(),
"searching cart library by string: \"%s\" [%s]",
d_filter_edit->text().toUtf8().constData(),
RDConfig::hexify(d_filter_edit->text()).toUtf8().constData());
}
emit filterChanged(d_model_filter_sql,d_model_cart_limit); emit filterChanged(d_model_filter_sql,d_model_cart_limit);
} }
} }

View File

@ -399,6 +399,18 @@ bool RDConfig::suppressRdcatchMeterUpdates() const
} }
bool RDConfig::logSearchStrings() const
{
return conf_log_search_strings;
}
int RDConfig::logSearchStringsLevel() const
{
return conf_log_search_strings_level;
}
int RDConfig::meterBasePort() const int RDConfig::meterBasePort() const
{ {
return conf_meter_base_port; return conf_meter_base_port;
@ -625,6 +637,9 @@ bool RDConfig::load()
profile->boolValue("Hacks","DisableMaintChecks",false); profile->boolValue("Hacks","DisableMaintChecks",false);
conf_suppress_rdcatch_meter_updates= conf_suppress_rdcatch_meter_updates=
profile->boolValue("Hacks","SuppressRdcatchMeterUpdates",false); profile->boolValue("Hacks","SuppressRdcatchMeterUpdates",false);
conf_log_search_strings_level=
SyslogPriorityLevel(profile->stringValue("Debugging","LogSearchStrings",""),
&conf_log_search_strings);
conf_meter_base_port= conf_meter_base_port=
profile->intValue("Hacks","MeterPortBaseNumber",RD_DEFAULT_METER_SOCKET_BASE_UDP_PORT); profile->intValue("Hacks","MeterPortBaseNumber",RD_DEFAULT_METER_SOCKET_BASE_UDP_PORT);
conf_meter_port_range= conf_meter_port_range=
@ -754,6 +769,8 @@ void RDConfig::clear()
conf_disable_maint_checks=false; conf_disable_maint_checks=false;
conf_save_webget_files_directory=""; conf_save_webget_files_directory="";
conf_suppress_rdcatch_meter_updates=false; conf_suppress_rdcatch_meter_updates=false;
conf_log_search_strings=false;
conf_log_search_strings_level=LOG_DEBUG;
conf_lock_rdairplay_memory=false; conf_lock_rdairplay_memory=false;
conf_meter_base_port=RD_DEFAULT_METER_SOCKET_BASE_UDP_PORT; conf_meter_base_port=RD_DEFAULT_METER_SOCKET_BASE_UDP_PORT;
conf_meter_port_range=RD_METER_SOCKET_PORT_RANGE; conf_meter_port_range=RD_METER_SOCKET_PORT_RANGE;
@ -854,3 +871,46 @@ QString RDConfig::rdselectExitCodeText(RDSelectExitCode code)
return ret; return ret;
} }
QString RDConfig::hexify(const QByteArray &data)
{
QString ret;
for(int i=0;i<data.length();i++) {
ret+=QString::asprintf("%02X ",0xff&data.at(i));
}
return ret.trimmed();
}
QString RDConfig::hexify(const QString &str)
{
return RDConfig::hexify(str.toUtf8());
}
int RDConfig::SyslogPriorityLevel(const QString &str,bool *ok) const
{
QMap<QString,int> levels;
levels["LOG_EMERG"]=LOG_EMERG;
levels["LOG_ALERT"]=LOG_ALERT;
levels["LOG_CRIT"]=LOG_CRIT;
levels["LOG_ERR"]=LOG_ERR;
levels["LOG_WARNING"]=LOG_WARNING;
levels["LOG_NOTICE"]=LOG_NOTICE;
levels["LOG_INFO"]=LOG_INFO;
levels["LOG_DEBUG"]=LOG_DEBUG;
int ret=levels.value(str.trimmed().toUpper(),-1);
if(ret<0) {
ret=LOG_DEBUG;
*ok=false;
}
else {
*ok=true;
}
return ret;
}

View File

@ -105,6 +105,8 @@ class RDConfig
int meterPortRange() const; int meterPortRange() const;
QString saveWebgetFilesDirectory() const; QString saveWebgetFilesDirectory() const;
bool suppressRdcatchMeterUpdates() const; bool suppressRdcatchMeterUpdates() const;
bool logSearchStrings() const;
int logSearchStringsLevel() const;
bool enableMixerLogging() const; bool enableMixerLogging() const;
uid_t uid() const; uid_t uid() const;
gid_t gid() const; gid_t gid() const;
@ -126,8 +128,11 @@ class RDConfig
void clear(); void clear();
static QString createTablePostfix(const QString &engine); static QString createTablePostfix(const QString &engine);
static QString rdselectExitCodeText(RDSelectExitCode code); static QString rdselectExitCodeText(RDSelectExitCode code);
static QString hexify(const QByteArray &data);
static QString hexify(const QString &str);
private: private:
int SyslogPriorityLevel(const QString &str,bool *ok) const;
QString conf_filename; QString conf_filename;
QString conf_module_name; QString conf_module_name;
QString conf_mysql_hostname; QString conf_mysql_hostname;
@ -175,6 +180,8 @@ class RDConfig
int conf_font_default_size; int conf_font_default_size;
QString conf_http_user_agent; QString conf_http_user_agent;
bool conf_disable_maint_checks; bool conf_disable_maint_checks;
bool conf_log_search_strings;
int conf_log_search_strings_level;
bool conf_lock_rdairplay_memory; bool conf_lock_rdairplay_memory;
QString conf_save_webget_files_directory; QString conf_save_webget_files_directory;
bool conf_suppress_rdcatch_meter_updates; bool conf_suppress_rdcatch_meter_updates;