ctkLogger.cpp

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 
00021 // Qt includes
00022 #include <QDebug>
00023 #include <QSqlDatabase>
00024 
00025 #include "ctkLogger.h"
00026 
00027 // log4cpp
00028 #include <log4cpp/BasicConfigurator.hh>
00029 #include <log4cpp/PropertyConfigurator.hh>
00030 #include <log4cpp/Layout.hh>
00031 #include <log4cpp/Priority.hh>
00032 #include <log4cpp/Category.hh>
00033 #include <log4cpp/PatternLayout.hh>
00034 #include <log4cpp/BasicLayout.hh>
00035 #include <log4cpp/OstreamAppender.hh>
00036 #include <log4cpp/FileAppender.hh>
00037 
00038 
00039 class ctkLogger::ctkInternal {
00040 public:
00041   ctkInternal( QString name ) : Logger ( ::log4cpp::Category::getInstance ( name.toStdString().c_str() ) ) {
00042   }
00043   log4cpp::Category& Logger;
00044 };
00045 
00046 ctkLogger::ctkLogger(QString name, QObject* _parent): Superclass(_parent)
00047 {
00048   this->Internal = new ctkInternal ( name );
00049 }
00050 
00051 ctkLogger::~ctkLogger()
00052 {
00053   delete this->Internal;
00054 }
00055 
00056 
00057 
00058 void ctkLogger::debug ( QString s ) 
00059 { 
00060   this->Internal->Logger.debug ( s.toStdString() );
00061 }
00062 void ctkLogger::info ( QString s ) 
00063 { 
00064   this->Internal->Logger.info ( s.toStdString() );
00065 }
00066 void ctkLogger::notice ( QString s ) 
00067 { 
00068   this->Internal->Logger.notice ( s.toStdString() );
00069 }
00070 void ctkLogger::warn ( QString s ) 
00071 { 
00072   this->Internal->Logger.warn ( s.toStdString() );
00073 }
00074 void ctkLogger::warning ( QString s ) 
00075 { 
00076   this->Internal->Logger.warn ( s.toStdString() );
00077 }
00078 void ctkLogger::error ( QString s ) 
00079 { 
00080   this->Internal->Logger.error ( s.toStdString() );
00081 }
00082 void ctkLogger::crit ( QString s ) 
00083 { 
00084   this->Internal->Logger.crit ( s.toStdString() );
00085 }
00086 void ctkLogger::critical ( QString s ) 
00087 { 
00088   this->Internal->Logger.crit ( s.toStdString() );
00089 }
00090 void ctkLogger::alert ( QString s ) 
00091 { 
00092   this->Internal->Logger.alert ( s.toStdString() );
00093 }
00094 void ctkLogger::emerg ( QString s ) 
00095 { 
00096   this->Internal->Logger.emerg ( s.toStdString() );
00097 }
00098 void ctkLogger::emergercy ( QString s ) 
00099 { 
00100   this->Internal->Logger.emerg ( s.toStdString() );
00101 }
00102 void ctkLogger::fatal ( QString s ) 
00103 { 
00104   this->Internal->Logger.fatal ( s.toStdString() );
00105 }
00106 
00107 void ctkLogger::setDebug() 
00108 { 
00109   this->Internal->Logger.setPriority ( log4cpp::Priority::DEBUG ); 
00110 }
00111 void ctkLogger::setInfo() 
00112 { 
00113   this->Internal->Logger.setPriority ( log4cpp::Priority::INFO ); 
00114 }
00115 void ctkLogger::setNotice() 
00116 { 
00117   this->Internal->Logger.setPriority ( log4cpp::Priority::NOTICE ); 
00118 }
00119 void ctkLogger::setWarn() 
00120 { 
00121   this->Internal->Logger.setPriority ( log4cpp::Priority::WARN ); 
00122 }
00123 void ctkLogger::setWarning() 
00124 { 
00125   this->Internal->Logger.setPriority ( log4cpp::Priority::WARN ); 
00126 }
00127 void ctkLogger::setError() 
00128 { 
00129   this->Internal->Logger.setPriority ( log4cpp::Priority::ERROR ); 
00130 }
00131 void ctkLogger::setCrit() 
00132 { 
00133   this->Internal->Logger.setPriority ( log4cpp::Priority::CRIT ); 
00134 }
00135 void ctkLogger::setCritical() 
00136 { 
00137   this->Internal->Logger.setPriority ( log4cpp::Priority::CRIT ); 
00138 }
00139 void ctkLogger::setAlert() 
00140 { 
00141   this->Internal->Logger.setPriority ( log4cpp::Priority::ALERT ); 
00142 }
00143 void ctkLogger::setEmerg() 
00144 { 
00145   this->Internal->Logger.setPriority ( log4cpp::Priority::EMERG ); 
00146 }
00147 void ctkLogger::setEmergercy() 
00148 { 
00149   this->Internal->Logger.setPriority ( log4cpp::Priority::EMERG ); 
00150 }
00151 void ctkLogger::setFatal() 
00152 { 
00153   this->Internal->Logger.setPriority ( log4cpp::Priority::FATAL ); 
00154 }
00155 
00156 bool ctkLogger::isDebugEnabled() 
00157 { 
00158   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::DEBUG ); 
00159 }
00160 bool ctkLogger::isInfoEnabled() 
00161 { 
00162   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::INFO ); 
00163 }
00164 bool ctkLogger::isNoticeEnabled() 
00165 { 
00166   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::NOTICE ); 
00167 }
00168 bool ctkLogger::isWarnEnabled() 
00169 { 
00170   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::WARN ); 
00171 }
00172 bool ctkLogger::isWarningEnabled() 
00173 { 
00174   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::WARN ); 
00175 }
00176 bool ctkLogger::isErrorEnabled() 
00177 { 
00178   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::ERROR ); 
00179 }
00180 bool ctkLogger::isCritEnabled() 
00181 { 
00182   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::CRIT ); 
00183 }
00184 bool ctkLogger::isCriticalEnabled() 
00185 { 
00186   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::CRIT ); 
00187 }
00188 bool ctkLogger::isAlertEnabled() 
00189 { 
00190   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::ALERT ); 
00191 }
00192 bool ctkLogger::isEmergEnabled() 
00193 { 
00194   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::EMERG ); 
00195 }
00196 bool ctkLogger::isEmergercyEnabled() 
00197 { 
00198   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::EMERG ); 
00199 }
00200 bool ctkLogger::isFatalEnabled() 
00201 { 
00202   return this->Internal->Logger.isPriorityEnabled ( log4cpp::Priority::FATAL ); 
00203 }
00204 
00205 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 21 May 2010 for CTK by  doxygen 1.6.1