Skip to content

Commit e5010ef

Browse files
authored
Merge pull request #632 from aregtech/feature/631-disable-log-priority
disable filtering mask
2 parents 67fa3b4 + dfe9c79 commit e5010ef

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

framework/aregextend/db/LogSqliteDatabase.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,12 @@ class LogSqliteDatabase : public IELogDatabaseEngine
502502
**/
503503
bool resetFilterMask(ITEM_ID instId = NEService::TARGET_ALL);
504504

505+
/**
506+
* \brief Disables the logging priority filter mask of the specified instance ID or for all instances.
507+
* Returns true if operation succeeded.
508+
**/
509+
bool disableFilterMask(ITEM_ID instId = NEService::TARGET_ALL);
510+
505511
//////////////////////////////////////////////////////////////////////////
506512
// Hidden methods
507513
//////////////////////////////////////////////////////////////////////////

framework/aregextend/db/private/LogSqliteDatabase.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,16 @@ namespace
388388
"UPDATE filter_rules SET log_mask = 1008;"
389389
};
390390

391+
constexpr std::string_view _sqlDisableFilterScopes
392+
{
393+
"UPDATE filter_rules SET log_mask = 0 WHERE target_id = ?;"
394+
};
395+
396+
constexpr std::string_view _sqlDisableFilterScopesAll
397+
{
398+
"UPDATE filter_rules SET log_mask = 0;"
399+
};
400+
391401
constexpr std::string_view _sqlDropTable
392402
{
393403
"DROP TABLE IF EXISTS %s;"
@@ -1400,6 +1410,25 @@ bool LogSqliteDatabase::resetFilterMask(ITEM_ID instId /*= NEService::TARGET_ALL
14001410
return stmt.execute();
14011411
}
14021412

1413+
bool LogSqliteDatabase::disableFilterMask(ITEM_ID instId)
1414+
{
1415+
if (tableExists("filter_rules", _temp) == false)
1416+
return false;
1417+
1418+
SqliteStatement stmt(mDatabase);
1419+
if (instId == NEService::TARGET_ALL)
1420+
{
1421+
VERIFY(stmt.prepare(_sqlDisableFilterScopesAll));
1422+
}
1423+
else
1424+
{
1425+
VERIFY(stmt.prepare(_sqlDisableFilterScopes));
1426+
stmt.bindUint64(0, instId);
1427+
}
1428+
1429+
return stmt.execute();
1430+
}
1431+
14031432
bool LogSqliteDatabase::tableExists(const char* table, const char* master /*= nullptr*/)
14041433
{
14051434
bool result{ false };

0 commit comments

Comments
 (0)