Kaynağa Gözat

Updated Logger with some utility methods to log messages and query the logger status.

Daniel Blezek 15 yıl önce
ebeveyn
işleme
0b06ca798a
2 değiştirilmiş dosya ile 189 ekleme ve 0 silme
  1. 150 0
      Libs/Core/ctkLogger.cpp
  2. 39 0
      Libs/Core/ctkLogger.h

+ 150 - 0
Libs/Core/ctkLogger.cpp

@@ -53,3 +53,153 @@ ctkLogger::~ctkLogger()
   delete this->Internal;
 }
 
+
+
+void ctkLogger::debug ( QString s ) 
+{ 
+  this->Internal->Logger.debug ( s.toStdString() );
+}
+void ctkLogger::info ( QString s ) 
+{ 
+  this->Internal->Logger.info ( s.toStdString() );
+}
+void ctkLogger::notice ( QString s ) 
+{ 
+  this->Internal->Logger.notice ( s.toStdString() );
+}
+void ctkLogger::warn ( QString s ) 
+{ 
+  this->Internal->Logger.warn ( s.toStdString() );
+}
+void ctkLogger::warning ( QString s ) 
+{ 
+  this->Internal->Logger.warn ( s.toStdString() );
+}
+void ctkLogger::error ( QString s ) 
+{ 
+  this->Internal->Logger.error ( s.toStdString() );
+}
+void ctkLogger::crit ( QString s ) 
+{ 
+  this->Internal->Logger.crit ( s.toStdString() );
+}
+void ctkLogger::critical ( QString s ) 
+{ 
+  this->Internal->Logger.crit ( s.toStdString() );
+}
+void ctkLogger::alert ( QString s ) 
+{ 
+  this->Internal->Logger.alert ( s.toStdString() );
+}
+void ctkLogger::emerg ( QString s ) 
+{ 
+  this->Internal->Logger.emerg ( s.toStdString() );
+}
+void ctkLogger::emergercy ( QString s ) 
+{ 
+  this->Internal->Logger.emerg ( s.toStdString() );
+}
+void ctkLogger::fatal ( QString s ) 
+{ 
+  this->Internal->Logger.fatal ( s.toStdString() );
+}
+
+void ctkLogger::setDebug() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::DEBUG ); 
+}
+void ctkLogger::setInfo() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::INFO ); 
+}
+void ctkLogger::setNotice() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::NOTICE ); 
+}
+void ctkLogger::setWarn() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::WARN ); 
+}
+void ctkLogger::setWarning() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::WARN ); 
+}
+void ctkLogger::setError() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::ERROR ); 
+}
+void ctkLogger::setCrit() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::CRIT ); 
+}
+void ctkLogger::setCritical() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::CRIT ); 
+}
+void ctkLogger::setAlert() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::ALERT ); 
+}
+void ctkLogger::setEmerg() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::EMERG ); 
+}
+void ctkLogger::setEmergercy() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::EMERG ); 
+}
+void ctkLogger::setFatal() 
+{ 
+  this->Internal->Logger.setPriority ( log4cpp::Priority::FATAL ); 
+}
+
+bool ctkLogger::isDebugEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::DEBUG ); 
+}
+bool ctkLogger::isInfoEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::INFO ); 
+}
+bool ctkLogger::isNoticeEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::NOTICE ); 
+}
+bool ctkLogger::isWarnEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::WARN ); 
+}
+bool ctkLogger::isWarningEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::WARN ); 
+}
+bool ctkLogger::isErrorEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::ERROR ); 
+}
+bool ctkLogger::isCritEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::CRIT ); 
+}
+bool ctkLogger::isCriticalEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::CRIT ); 
+}
+bool ctkLogger::isAlertEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::ALERT ); 
+}
+bool ctkLogger::isEmergEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::EMERG ); 
+}
+bool ctkLogger::isEmergercyEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::EMERG ); 
+}
+bool ctkLogger::isFatalEnabled() 
+{ 
+  return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::FATAL ); 
+}
+
+

+ 39 - 0
Libs/Core/ctkLogger.h

@@ -36,6 +36,45 @@ public:
   explicit ctkLogger ( QString name, QObject* parent = 0 );
   virtual ~ctkLogger ();
   
+  void debug ( QString s );
+  void info ( QString s );
+  void notice ( QString s );
+  void warn ( QString s );
+  void warning ( QString s );
+  void error ( QString s );
+  void crit ( QString s );
+  void critical ( QString s );
+  void alert ( QString s );
+  void emerg ( QString s );
+  void emergercy ( QString s );
+  void fatal ( QString s );
+
+  void setDebug();
+  void setInfo();
+  void setNotice();
+  void setWarn();
+  void setWarning();
+  void setError();
+  void setCrit();
+  void setCritical();
+  void setAlert();
+  void setEmerg();
+  void setEmergercy();
+  void setFatal();
+
+  bool isDebugEnabled();
+  bool isInfoEnabled();
+  bool isNoticeEnabled();
+  bool isWarnEnabled();
+  bool isWarningEnabled();
+  bool isErrorEnabled();
+  bool isCritEnabled();
+  bool isCriticalEnabled();
+  bool isAlertEnabled();
+  bool isEmergEnabled();
+  bool isEmergercyEnabled();
+  bool isFatalEnabled();
+
 private:
   class ctkInternal;
   ctkInternal *Internal;