メインページ   モジュール   名前空間一覧   クラス階層   アルファベット順一覧   構成   ファイル一覧   構成メンバ   ファイルメンバ   関連ページ    

TSystemLogging.hh

解説を見る。
00001 // =====================================================================
00047 // =====================================================================
00048 #ifndef CLDAQ__TSYSTEMLOGGING_HH
00049 #define CLDAQ__TSYSTEMLOGGING_HH
00050 
00051 #include "Tglobals.h"
00052 
00072 class TSystemLogging
00073 {
00074 
00075   public:
00077     enum {
00079       CONS = LOG_CONS, 
00081       NDELAY = LOG_NDELAY,
00083       NOWAIT = LOG_NOWAIT,
00085       ODELAY = LOG_ODELAY,
00087       PERORR = LOG_PERROR,
00089       PID = LOG_PID
00090     };
00091 
00093     enum {
00095       AUTH = LOG_AUTH,
00097       AUTHPRIV = LOG_AUTHPRIV,
00099       CRON = LOG_CRON,
00101       DAEMON = LOG_DAEMON,
00103       FTP = LOG_FTP,
00105       KERN = LOG_KERN,
00107       LOCAL0 = LOG_LOCAL0,
00109       LOCAL1 = LOG_LOCAL1,
00111       LOCAL2 = LOG_LOCAL2,
00113       LOCAL3 = LOG_LOCAL3,
00115       LOCAL4 = LOG_LOCAL4,
00117       LOCAL5 = LOG_LOCAL5,
00119       LOCAL6 = LOG_LOCAL6,
00121       LOCAL7 = LOG_LOCAL7,
00123       LPR = LOG_LPR,
00125       MAIL = LOG_MAIL,
00127       NEWS = LOG_NEWS,
00129       SYSLOG = LOG_SYSLOG,
00131       USER = LOG_USER,
00133       UUCP = LOG_UUCP
00134     };
00135 
00137     enum {
00139       EMERG = LOG_EMERG,
00141       ALERT = LOG_ALERT,
00143       CRIT = LOG_CRIT,
00145       ERROR = LOG_ERR,
00147       WARNING = LOG_WARNING,
00149       NOTICE = LOG_NOTICE,
00151       INFO = LOG_INFO,
00153       DEBUG = LOG_DEBUG
00154     };
00155 
00156 
00157   private:
00158     Tint theLevel;
00159     Tint theFacility;
00160     Tint theOption;
00161     Tstring theID;
00162     Tstring theMessageBuffer;
00163 
00164   public:
00165     TSystemLogging( Tint level=INFO, Tint facility=USER, Tint option=PID|ODELAY );
00166     TSystemLogging( const TSystemLogging& right );
00167     ~TSystemLogging();
00168 
00169   public:
00170     Tvoid Open( Tint option, Tint facility );
00171     Tvoid Open( Tint option );
00172     Tvoid Open();
00173     Tvoid Close();
00174     Tvoid Record( Tint level, const Tstring& format, ...);
00175     Tvoid Record( const Tstring& format, ...);
00176     Tvoid Record( Tint level, const Tstring& format, va_list ap );
00177     Tvoid Record( const Tstring& format, va_list ap );
00178 
00179   public:
00180     Tint GetLevel() const;
00181     Tint GetFacility() const;
00182     Tint GetOption() const;
00183     const Tstring& GetID() const;
00184     const Tstring& GetMessageBuffer() const;
00185     Tvoid SetLevel( Tint level );
00186     Tvoid SetFacility( Tint facility );
00187     Tvoid SetOption( Tint option );
00188     Tvoid SetID( const Tstring& ident );
00189     Tvoid SetID();
00190     Tvoid SetMessageBuffer( const Tstring& buffer );
00191 
00192   public:
00193     Tvoid AddBuffer( const Tstring& message );
00194     Tvoid ClearBuffer();
00195 
00196   public:
00197     const TSystemLogging& operator=( const TSystemLogging& right );
00198     TSystemLogging& operator<<( Tostream& (*pf)(Tostream&) );
00199     TSystemLogging& operator<<( Tostream& os );
00200     TSystemLogging& operator<<( const Tstring& message );
00201     TSystemLogging& operator<<( Tdouble n );
00202     TSystemLogging& operator<<( Tdouble* n );
00203     TSystemLogging& operator<<( Tfloat n );
00204     TSystemLogging& operator<<( Tfloat* n );
00205     TSystemLogging& operator<<( Tint n );
00206     TSystemLogging& operator<<( Tint* n );
00207     TSystemLogging& operator<<( TUint n );
00208     TSystemLogging& operator<<( TUint* n );
00209     TSystemLogging& operator<<( Tshort n );
00210     TSystemLogging& operator<<( Tshort* n );
00211     TSystemLogging& operator<<( TUshort n );
00212     TSystemLogging& operator<<( TUshort* n );
00213     TSystemLogging& operator<<( Tlong n );
00214     TSystemLogging& operator<<( Tlong* n );
00215     TSystemLogging& operator<<( TUlong n );
00216     TSystemLogging& operator<<( TUlong* n );
00217     TSystemLogging& operator<<( Tchar n );
00218     TSystemLogging& operator<<( TUchar n );
00219 
00220 #ifdef __CLDAQ_ROOT_DLL
00221     ClassDef(TSystemLogging,0)
00222 #endif
00223 
00224 };
00225 
00226 inline Tvoid TSystemLogging::AddBuffer( const Tstring& message )
00227 {
00228   theMessageBuffer += message;
00229   return;
00230 }
00231 
00232 inline Tvoid TSystemLogging::ClearBuffer()
00233 {
00234   theMessageBuffer.clear();
00235   return;
00236 }
00237 
00238 inline TSystemLogging& TSystemLogging::operator<<( Tostream& os )
00239 {
00240   return *this;
00241 }
00242 
00243 inline TSystemLogging& TSystemLogging::operator<<( const Tstring& message )
00244 {
00245   AddBuffer( message );
00246   return *this;
00247 }
00248 
00249 inline TSystemLogging& TSystemLogging::operator<<( Tchar n )
00250 {
00251   Tstring s(1,n);
00252   return *this << s;
00253 }
00254 
00255 inline TSystemLogging& TSystemLogging::operator<<( TUchar n )
00256 {
00257   Tstring s(1,(Tchar)n);
00258   return *this << s;
00259 }
00260 
00261 inline TSystemLogging& TSystemLogging::operator<<( Tdouble n )
00262 {
00263   return *this << dtostr( n, 0 );
00264 }
00265 
00266 inline TSystemLogging& TSystemLogging::operator<<( Tdouble* n )
00267 {
00268   return *this << (Tint*)n;
00269 }
00270 
00271 inline TSystemLogging& TSystemLogging::operator<<( Tfloat n )
00272 {
00273   return *this << ftostr( n, 0 );
00274 }
00275 
00276 inline TSystemLogging& TSystemLogging::operator<<( Tfloat* n )
00277 {
00278   return *this << (Tint*)n;
00279 }
00280 
00281 inline TSystemLogging& TSystemLogging::operator<<( Tint n )
00282 {
00283   return *this << itostr( n, 0 );
00284 }
00285 
00286 inline TSystemLogging& TSystemLogging::operator<<( TUint n )
00287 {
00288   return *this << ultostr( n, 0 );
00289 }
00290 
00291 inline TSystemLogging& TSystemLogging::operator<<( TUint* n )
00292 {
00293   return *this << (Tint*)n;
00294 }
00295 
00296 inline TSystemLogging& TSystemLogging::operator<<( Tshort n )
00297 {
00298   return *this << itostr( n, 0 );
00299 }
00300 
00301 inline TSystemLogging& TSystemLogging::operator<<( Tshort* n )
00302 {
00303   return *this << (Tint*)n;
00304 }
00305 
00306 inline TSystemLogging& TSystemLogging::operator<<( TUshort n )
00307 {
00308   return *this << ultostr( n, 0 );
00309 }
00310 
00311 inline TSystemLogging& TSystemLogging::operator<<( TUshort* n )
00312 {
00313   return *this << (Tint*)n;
00314 }
00315 
00316 inline TSystemLogging& TSystemLogging::operator<<( Tlong n )
00317 {
00318   return *this << ltostr( n, 0 );
00319 }
00320 
00321 inline TSystemLogging& TSystemLogging::operator<<( Tlong* n )
00322 {
00323   return *this << (Tint*)n;
00324 }
00325 
00326 inline TSystemLogging& TSystemLogging::operator<<( TUlong n )
00327 {
00328   return *this << ultostr( n, 0 );
00329 }
00330 
00331 inline TSystemLogging& TSystemLogging::operator<<( TUlong* n )
00332 {
00333   return *this << (Tint*)n;
00334 }
00335 
00336 inline Tint TSystemLogging::GetLevel() const
00337 {
00338   return theLevel;
00339 }
00340 
00341 inline Tint TSystemLogging::GetFacility() const
00342 {
00343   return theFacility;
00344 }
00345 
00346 inline Tint TSystemLogging::GetOption() const
00347 {
00348   return theOption;
00349 }
00350 
00351 inline const Tstring& TSystemLogging::GetID() const
00352 {
00353   return theID;
00354 }
00355 
00356 inline const Tstring& TSystemLogging::GetMessageBuffer() const
00357 {
00358   return theMessageBuffer;
00359 }
00360 
00361 inline Tvoid TSystemLogging::SetLevel( Tint level )
00362 {
00363   theLevel = level;
00364   SetID();
00365   return;
00366 }
00367 
00368 inline Tvoid TSystemLogging::SetFacility( Tint facility )
00369 {
00370   theFacility = facility;
00371   return;
00372 }
00373 
00374 inline Tvoid TSystemLogging::SetOption( Tint option )
00375 {
00376   theOption = option;
00377   return;
00378 }
00379 
00380 inline Tvoid TSystemLogging::SetID( const Tstring& ident )
00381 {
00382   theID = ident;
00383   return;
00384 }
00385 
00386 inline Tvoid TSystemLogging::SetMessageBuffer( const Tstring& buffer )
00387 {
00388   theMessageBuffer = buffer;
00389   return;
00390 }
00391 
00392 #ifdef __cplusplus
00393 extern "C" {
00394 #endif
00395   extern TSystemLogging Temerg;
00396   extern TSystemLogging Talert;
00397   extern TSystemLogging Tcrit;
00398   extern TSystemLogging Terror;
00399   extern TSystemLogging Twarn;
00400   extern TSystemLogging Tnotice;
00401   extern TSystemLogging Tinfo;
00402   extern TSystemLogging Tdebug;
00403 #ifdef __cplusplus
00404 }
00405 #endif
00406 
00407 #endif


CLDAQ - a Class Library for DataAcQuisition (Version 1.14.3)
Go IWAI -- goiwai at users.sourceforge.jp