Obey naming rules
authorSebastian Goth <seezer@roath.org>
Fri, 25 Jul 2008 12:14:57 +0000 (14:14 +0200)
committerSebastian Goth <seezer@roath.org>
Wed, 30 Jul 2008 09:25:00 +0000 (11:25 +0200)
src/common/logger.cpp
src/common/logger.h

index 5d7c64a..60cc98c 100644 (file)
 
 Logger::~Logger() {
   QDateTime date = QDateTime::currentDateTime();
-  if(stream->logLevel == DebugLevel) stream->buffer.prepend("Debug: ");
-  else if (stream->logLevel == InfoLevel) stream->buffer.prepend("Info: ");
-  else if (stream->logLevel == WarningLevel) stream->buffer.prepend("Warning: ");
-  else if (stream->logLevel == ErrorLevel) stream->buffer.prepend("Error: ");
-  stream->buffer.prepend(date.toString("yyyy-MM-dd hh:mm:ss "));
+  if(_stream->logLevel == DebugLevel) _stream->buffer.prepend("Debug: ");
+  else if (_stream->logLevel == InfoLevel) _stream->buffer.prepend("Info: ");
+  else if (_stream->logLevel == WarningLevel) _stream->buffer.prepend("Warning: ");
+  else if (_stream->logLevel == ErrorLevel) _stream->buffer.prepend("Error: ");
+  _stream->buffer.prepend(date.toString("yyyy-MM-dd hh:mm:ss "));
   log();
-  delete stream;
+  delete _stream;
 }
 
 void Logger::log() {
@@ -44,7 +44,7 @@ void Logger::log() {
   else if (Global::parser.value("loglevel") == "Error") lvl = ErrorLevel;
   else lvl = InfoLevel;
 
-  if(stream->logLevel < lvl) return;
+  if(_stream->logLevel < lvl) return;
 
   // if we can't open logfile we log to stdout
   QTextStream out(stdout);
@@ -53,9 +53,9 @@ void Logger::log() {
     file.setFileName(Global::parser.value("logfile"));
     if (file.open(QIODevice::Append | QIODevice::Text)) {
       out.setDevice(&file);
-      stream->buffer.remove(QChar('\n'));
+      _stream->buffer.remove(QChar('\n'));
     }
   }
-  out << stream->buffer << "\n";
+  out << _stream->buffer << "\n";
   if(file.isOpen()) file.close();
 }
index d9f935c..07ae015 100644 (file)
@@ -36,34 +36,34 @@ class Logger {
       ErrorLevel
     };
 
-    inline Logger(LogLevel level) : stream(new Stream(level)) {}
+    inline Logger(LogLevel level) : _stream(new Stream(level)) {}
     ~Logger();
 
-    inline Logger &operator<<(const char* t) { stream->internalStream << QString::fromAscii(t); return *this; }
-    inline Logger &operator<<(QChar t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(bool t) { stream->internalStream << (t ? "true" : "false"); return *this; }
-    inline Logger &operator<<(char t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(signed short t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(unsigned short t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(signed int t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(unsigned int t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(signed long t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(unsigned long t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(qint64 t) { stream->internalStream << QString::number(t); return *this; }
-    inline Logger &operator<<(quint64 t) { stream->internalStream << QString::number(t); return *this; }
-    inline Logger &operator<<(float t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(double t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(const QString & t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(const QLatin1String &t) { stream->internalStream << t.latin1(); return *this; }
-    inline Logger &operator<<(const QByteArray & t) { stream->internalStream << t ; return *this; }
-    inline Logger &operator<<(const void * t) { stream->internalStream << t; return *this; }
-    inline Logger &operator<<(const QStringList & t) { stream->internalStream << t.join(" "); return *this; }
-    inline Logger &operator<<(const BufferId & t) { stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
-    inline Logger &operator<<(const NetworkId & t) { stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
-    inline Logger &operator<<(const UserId & t) { stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
-    inline Logger &operator<<(const MsgId & t) { stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
-    inline Logger &operator<<(const IdentityId & t) { stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
-    inline Logger &operator<<(const AccountId & t) { stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
+    inline Logger &operator<<(const char* t) { _stream->internalStream << QString::fromAscii(t); return *this; }
+    inline Logger &operator<<(QChar t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(bool t) { _stream->internalStream << (t ? "true" : "false"); return *this; }
+    inline Logger &operator<<(char t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(signed short t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(unsigned short t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(signed int t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(unsigned int t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(signed long t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(unsigned long t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(qint64 t) { _stream->internalStream << QString::number(t); return *this; }
+    inline Logger &operator<<(quint64 t) { _stream->internalStream << QString::number(t); return *this; }
+    inline Logger &operator<<(float t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(double t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(const QString & t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(const QLatin1String &t) { _stream->internalStream << t.latin1(); return *this; }
+    inline Logger &operator<<(const QByteArray & t) { _stream->internalStream << t ; return *this; }
+    inline Logger &operator<<(const void * t) { _stream->internalStream << t; return *this; }
+    inline Logger &operator<<(const QStringList & t) { _stream->internalStream << t.join(" "); return *this; }
+    inline Logger &operator<<(const BufferId & t) { _stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
+    inline Logger &operator<<(const NetworkId & t) { _stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
+    inline Logger &operator<<(const UserId & t) { _stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
+    inline Logger &operator<<(const MsgId & t) { _stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
+    inline Logger &operator<<(const IdentityId & t) { _stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
+    inline Logger &operator<<(const AccountId & t) { _stream->internalStream << QVariant::fromValue(t).toInt(); return *this; }
 
     void log();
   private:
@@ -74,7 +74,7 @@ class Logger {
       QTextStream internalStream;
       QString buffer;
       LogLevel logLevel;
-    } *stream;
+    } *_stream;
 };
 
 inline Logger quDebug() { return Logger(Logger::DebugLevel); }