Prechádzať zdrojové kódy

STYLE: ctkLogger - Remove extra indent, added function separator

Jean-Christophe Fillion-Robin 15 rokov pred
rodič
commit
0bcf50621f
2 zmenil súbory, kde vykonal 82 pridanie a 45 odobranie
  1. 75 38
      Libs/Core/ctkLogger.cpp
  2. 7 7
      Libs/Core/ctkLogger.h

+ 75 - 38
Libs/Core/ctkLogger.cpp

@@ -22,124 +22,161 @@
 #include <QDebug>
 #include <QSqlDatabase>
 
-#include "ctkLogger.h"
+// CTK includes
+#include <ctkLogger.h>
 
-// log4cpp
-#include "log4qt/log4qt.h"
-#include "log4qt/logger.h"
-#include "log4qt/basicconfigurator.h"
+// Log4Qt includes
+#include <log4qt/log4qt.h>
+#include <log4qt/logger.h>
+#include <log4qt/basicconfigurator.h>
 
 class ctkLoggerPrivate: public ctkPrivate<ctkLogger>
 {
 public:
-  ctkLoggerPrivate() {};
-  ~ctkLoggerPrivate() {};
+  ctkLoggerPrivate(){};
+  ~ctkLoggerPrivate(){};
   Log4Qt::Logger *Logger;
 };
 
+//-----------------------------------------------------------------------------
 ctkLogger::ctkLogger(QString name, QObject* _parent): Superclass(_parent)
 {
   CTK_D(ctkLogger);
-  d->Logger = Log4Qt::Logger::logger( name.toStdString().c_str() );
+  d->Logger = Log4Qt::Logger::logger( name.toStdString().c_str());
 }
 
+//-----------------------------------------------------------------------------
 ctkLogger::~ctkLogger()
 {
 }
 
+//-----------------------------------------------------------------------------
 void ctkLogger::configure()
 {
   Log4Qt::BasicConfigurator::configure();
 }
 
-void ctkLogger::debug ( QString s ) 
+//-----------------------------------------------------------------------------
+void ctkLogger::debug(const QString& s)
 { 
   CTK_D(ctkLogger);
-  d->Logger->debug ( s );
+  d->Logger->debug(s);
 }
-void ctkLogger::info ( QString s ) 
+
+//-----------------------------------------------------------------------------
+void ctkLogger::info(const QString& s)
 { 
   CTK_D(ctkLogger);
-  d->Logger->info ( s );
+  d->Logger->info(s);
 }
-void ctkLogger::trace ( QString s ) 
+
+//-----------------------------------------------------------------------------
+void ctkLogger::trace(const QString& s)
 { 
   CTK_D(ctkLogger);
-  d->Logger->trace ( s );
+  d->Logger->trace(s);
 }
-void ctkLogger::warn ( QString s ) 
+
+//-----------------------------------------------------------------------------
+void ctkLogger::warn(const QString& s)
 { 
   CTK_D(ctkLogger);
-  d->Logger->warn ( s );
+  d->Logger->warn(s);
 }
-void ctkLogger::error ( QString s ) 
+
+//-----------------------------------------------------------------------------
+void ctkLogger::error(const QString& s)
 { 
   CTK_D(ctkLogger);
-  d->Logger->error ( s );
+  d->Logger->error(s);
 }
-void ctkLogger::fatal ( QString s ) 
+
+//-----------------------------------------------------------------------------
+void ctkLogger::fatal(const QString& s)
 { 
   CTK_D(ctkLogger);
-  d->Logger->fatal ( s );
+  d->Logger->fatal(s);
 }
 
-void ctkLogger::setDebug() 
+//-----------------------------------------------------------------------------
+void ctkLogger::setDebug()
 {
   CTK_D(ctkLogger);
-  d->Logger->setLevel ( Log4Qt::Level ( Log4Qt::Level::DEBUG_INT ) ); 
+  d->Logger->setLevel(Log4Qt::Level(Log4Qt::Level::DEBUG_INT));
 }
-void ctkLogger::setInfo() 
+
+//-----------------------------------------------------------------------------
+void ctkLogger::setInfo()
 { 
   CTK_D(ctkLogger);
-  d->Logger->setLevel ( Log4Qt::Level ( Log4Qt::Level::INFO_INT ) ); 
+  d->Logger->setLevel(Log4Qt::Level(Log4Qt::Level::INFO_INT));
 }
-void ctkLogger::setTrace() 
+
+//-----------------------------------------------------------------------------
+void ctkLogger::setTrace()
 { 
   CTK_D(ctkLogger);
-  d->Logger->setLevel ( Log4Qt::Level ( Log4Qt::Level::TRACE_INT ) ); 
+  d->Logger->setLevel(Log4Qt::Level(Log4Qt::Level::TRACE_INT));
 }
-void ctkLogger::setWarn() 
+
+//-----------------------------------------------------------------------------
+void ctkLogger::setWarn()
 { 
   CTK_D(ctkLogger);
-  d->Logger->setLevel ( Log4Qt::Level ( Log4Qt::Level::WARN_INT ) ); 
+  d->Logger->setLevel(Log4Qt::Level(Log4Qt::Level::WARN_INT));
 }
-void ctkLogger::setError() 
+
+//-----------------------------------------------------------------------------
+void ctkLogger::setError()
 { 
   CTK_D(ctkLogger);
-  d->Logger->setLevel ( Log4Qt::Level ( Log4Qt::Level::ERROR_INT ) ); 
+  d->Logger->setLevel(Log4Qt::Level(Log4Qt::Level::ERROR_INT));
 }
-void ctkLogger::setFatal() 
+
+//-----------------------------------------------------------------------------
+void ctkLogger::setFatal()
 { 
   CTK_D(ctkLogger);
-  d->Logger->setLevel ( Log4Qt::Level ( Log4Qt::Level::FATAL_INT ) ); 
+  d->Logger->setLevel(Log4Qt::Level(Log4Qt::Level::FATAL_INT));
 }
 
-bool ctkLogger::isDebugEnabled() 
+//-----------------------------------------------------------------------------
+bool ctkLogger::isDebugEnabled()
 { 
   CTK_D(ctkLogger);
   return d->Logger->isDebugEnabled(); 
 }
-bool ctkLogger::isInfoEnabled() 
+
+//-----------------------------------------------------------------------------
+bool ctkLogger::isInfoEnabled()
 { 
   CTK_D(ctkLogger);
   return d->Logger->isInfoEnabled(); 
 }
-bool ctkLogger::isTraceEnabled() 
+
+//-----------------------------------------------------------------------------
+bool ctkLogger::isTraceEnabled()
 { 
   CTK_D(ctkLogger);
   return d->Logger->isTraceEnabled(); 
 }
-bool ctkLogger::isWarnEnabled() 
+
+//-----------------------------------------------------------------------------
+bool ctkLogger::isWarnEnabled()
 { 
   CTK_D(ctkLogger);
   return d->Logger->isWarnEnabled(); 
 }
-bool ctkLogger::isErrorEnabled() 
+
+//-----------------------------------------------------------------------------
+bool ctkLogger::isErrorEnabled()
 { 
   CTK_D(ctkLogger);
   return d->Logger->isErrorEnabled(); 
 }
-bool ctkLogger::isFatalEnabled() 
+
+//-----------------------------------------------------------------------------
+bool ctkLogger::isFatalEnabled()
 { 
   CTK_D(ctkLogger);
   return d->Logger->isFatalEnabled(); 

+ 7 - 7
Libs/Core/ctkLogger.h

@@ -34,17 +34,17 @@ class CTK_CORE_EXPORT ctkLogger : public QObject
   Q_OBJECT
 public:
   typedef QObject Superclass;
-  explicit ctkLogger ( QString name, QObject* parent = 0 );
+  explicit ctkLogger(QString name, QObject* parent = 0);
   virtual ~ctkLogger ();
 
   static void configure();
   
-  void debug ( QString s );
-  void info ( QString s );
-  void trace ( QString s );
-  void warn ( QString s );
-  void error ( QString s );
-  void fatal ( QString s );
+  void debug(const QString& s);
+  void info(const QString& s);
+  void trace(const QString& s);
+  void warn(const QString& s);
+  void error(const QString& s);
+  void fatal(const QString& s);
 
   void setDebug();
   void setInfo();