Quiet cppcheck issues

This commit is contained in:
Isaac Connor 2021-04-20 12:59:59 -04:00
parent 813730f8b5
commit c0c5c07ecf
1 changed files with 6 additions and 10 deletions

View File

@ -126,24 +126,24 @@ void Logger::initialise(const std::string &id, const Options &options) {
Level tempLevel = INFO; Level tempLevel = INFO;
Level tempTerminalLevel = mTerminalLevel; Level tempTerminalLevel = mTerminalLevel;
Level tempDatabaseLevel = mDatabaseLevel;
Level tempFileLevel = mFileLevel;
Level tempSyslogLevel = mSyslogLevel;
if ( options.mTerminalLevel != NOOPT ) if ( options.mTerminalLevel != NOOPT )
tempTerminalLevel = options.mTerminalLevel; tempTerminalLevel = options.mTerminalLevel;
// DEBUG1 == 1. So >= DEBUG1, we set to DEBUG9?! Why? // DEBUG1 == 1. So >= DEBUG1, we set to DEBUG9?! Why? icon: because log_level_database only goes up to debug.
Level tempDatabaseLevel;
if ( options.mDatabaseLevel != NOOPT ) if ( options.mDatabaseLevel != NOOPT )
tempDatabaseLevel = options.mDatabaseLevel; tempDatabaseLevel = options.mDatabaseLevel;
else else
tempDatabaseLevel = config.log_level_database >= DEBUG1 ? DEBUG9 : config.log_level_database; tempDatabaseLevel = config.log_level_database >= DEBUG1 ? DEBUG9 : config.log_level_database;
Level tempFileLevel;
if ( options.mFileLevel != NOOPT ) if ( options.mFileLevel != NOOPT )
tempFileLevel = options.mFileLevel; tempFileLevel = options.mFileLevel;
else else
tempFileLevel = config.log_level_file >= DEBUG1 ? DEBUG9 : config.log_level_file; tempFileLevel = config.log_level_file >= DEBUG1 ? DEBUG9 : config.log_level_file;
Level tempSyslogLevel;
if ( options.mSyslogLevel != NOOPT ) if ( options.mSyslogLevel != NOOPT )
tempSyslogLevel = options.mSyslogLevel; tempSyslogLevel = options.mSyslogLevel;
else else
@ -297,9 +297,7 @@ const std::string &Logger::id(const std::string &id) {
Logger::Level Logger::level(Logger::Level level) { Logger::Level Logger::level(Logger::Level level) {
if ( level > NOOPT ) { if ( level > NOOPT ) {
level = limit(level); mLevel = limit(level);
if ( mLevel != level )
mLevel = level;
mEffectiveLevel = NOLOG; mEffectiveLevel = NOLOG;
if ( mTerminalLevel > mEffectiveLevel ) if ( mTerminalLevel > mEffectiveLevel )
@ -324,9 +322,7 @@ Logger::Level Logger::terminalLevel(Logger::Level terminalLevel) {
if ( terminalLevel > NOOPT ) { if ( terminalLevel > NOOPT ) {
if ( !mHasTerminal ) if ( !mHasTerminal )
terminalLevel = NOLOG; terminalLevel = NOLOG;
terminalLevel = limit(terminalLevel); mTerminalLevel = limit(terminalLevel);
if ( mTerminalLevel != terminalLevel )
mTerminalLevel = terminalLevel;
} }
return mTerminalLevel; return mTerminalLevel;
} }