zubairehman/Flogs

logLevelsEnabled can not enable lower than info

JTorkk opened this issue · 0 comments

JTorkk commented

Current if clause in flog.dart line 482 is:

if (LogLevel.values.indexOf(_config.activeLogLevel) <=
                LogLevel.values.indexOf(log.logLevel!) &&
            _config.logLevelsEnabled.contains(_config.activeLogLevel)) {
          //check to see if logcat debugging is enabled
          if (_config.isDebuggable) {
            print(Formatter.format(log, _config));
          }
          await _flogDao.insert(log);
        }

and it should be:

if (LogLevel.values.indexOf(_config.activeLogLevel) <=
                LogLevel.values.indexOf(log.logLevel!) ||
            _config.logLevelsEnabled.contains(_config.activeLogLevel)) {
          //check to see if logcat debugging is enabled
          if (_config.isDebuggable) {
            print(Formatter.format(log, _config));
          }
          await _flogDao.insert(log);
        }

Because currently used operator is && instead of || lower than info logs are never written to db even tho they are enabled in config.