+ if(_logLevel < lvl) return;
+
+ // if we can't open logfile we log to stdout
+ QTextStream out(stdout);
+ QFile file;
+ if(!Global::parser.value("logfile").isEmpty()) {
+ file.setFileName(Global::parser.value("logfile"));
+ if (file.open(QIODevice::Append | QIODevice::Text)) {
+ out.setDevice(&file);
+ _buffer.remove(QChar('\n'));
+ }
+ }
+ out << _buffer << endl;
+ if(file.isOpen()) file.close();