00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_LOG_PLUG_H_
00028 #define CEYLAN_LOG_PLUG_H_
00029
00030
00031 #include "CeylanLog.h"
00032
00033 #include <string>
00034
00035
00036
00037 namespace Ceylan
00038 {
00039
00040
00041 namespace Log
00042 {
00043
00044
00045
00047 class LogSource ;
00048
00049
00055 class LogTransport ;
00056
00057
00064 class LogListener ;
00065
00066
00071 class LogAggregator ;
00072
00073
00074
00095 class CEYLAN_DLL LogPlug
00096 {
00097
00098 public:
00099
00100
00102 static void SetInfoLogSource( LogSource & newInfoLogSource ) ;
00103
00104
00106 static LogSource & GetInfoLogSource() ;
00107
00108
00109
00111 static void SetTraceLogSource( LogSource & newTraceLogSource ) ;
00112
00113
00115 static LogSource & GetTraceLogSource() ;
00116
00117
00118
00120 static void SetDebugLogSource( LogSource & newDebugLogSource ) ;
00121
00122
00124 static LogSource & GetDebugLogSource() ;
00125
00126
00127
00129 static void SetWarningLogSource(
00130 LogSource & newWarningLogSource ) ;
00131
00132
00134 static LogSource & GetWarningLogSource() ;
00135
00136
00137
00139 static void SetErrorLogSource(
00140 LogSource & newErrorLogSource ) ;
00141
00142
00144 static LogSource & GetErrorLogSource() ;
00145
00146
00147
00148
00150 static void SetFatalLogSource(
00151 LogSource & newFatalLogSource ) ;
00152
00153
00155 static LogSource & GetFatalLogSource() ;
00156
00157
00163 static bool IsFatalLogSourceAvailable() ;
00164
00165
00166
00167
00169 static void SetLogRootLogSource(
00170 LogSource & newLogRootLogSource ) ;
00171
00172
00174 static LogSource & GetLogRootLogSource() ;
00175
00176
00177
00179 static void SetTransport( LogTransport & newTransport ) ;
00180
00181
00183 static LogTransport & GetTransport() ;
00184
00185
00186
00188 static void SetListener( LogListener & newListener ) ;
00189
00190
00192 static LogListener & GetListener() ;
00193
00194
00195
00197 static void SetAggregator( LogAggregator & newAggregator ) ;
00198
00199
00201 static LogAggregator & GetAggregator() ;
00202
00203
00209 static void CheckBlank() ;
00210
00211
00222 static void SetFullExecutablePath(
00223 const std::string & plugInitiatorFullName ) ;
00224
00225
00226
00235 static std::string GetFullExecutablePath() ;
00236
00237
00238
00249 static std::string GetSpeakerNameFrom(
00250 const std::string & plugInitiatorFullName ) ;
00251
00252
00258 static void CreateBasicPlug() ;
00259
00260
00261
00266 static void CreateNullPlug() ;
00267
00268
00269
00285 static void StartService( const std::string & plugCreator ) ;
00286
00287
00288
00299 static void StopService( bool warnIfAlreadyStopped = true ) ;
00300
00301
00302
00304 static const std::string GetSourceName() ;
00305
00306
00307
00309 static const std::string ToString(
00310 Ceylan::VerbosityLevels level = Ceylan::high ) ;
00311
00312
00319 static const std::string LogSystemNotInitialized ;
00320
00321
00322
00335 static void info( const std::string & message,
00336 LevelOfDetail levelOfDetail
00337 = Log::MaximumLevelOfDetailForMessage ) ;
00338
00339
00352 static void trace( const std::string & message,
00353 LevelOfDetail levelOfDetail =
00354 Log::DefaultLevelOfDetailForMessage ) ;
00355
00356
00357
00369 static void debug( const std::string & message,
00370 LevelOfDetail levelOfDetail =
00371 Log::DefaultLevelOfDetailForMessage ) ;
00372
00373
00374
00388 static void warning( const std::string & message,
00389 LevelOfDetail levelOfDetail =
00390 Log::MaximumLevelOfDetailForMessage ) ;
00391
00392
00393
00408 static void error( const std::string & message,
00409 LevelOfDetail levelOfDetail =
00410 Log::MaximumLevelOfDetailForMessage ) ;
00411
00412
00427 static void fatal( const std::string & message,
00428 LevelOfDetail levelOfDetail =
00429 Log::MaximumLevelOfDetailForMessage ) ;
00430
00431
00446 static void logroot( const std::string & message,
00447 LevelOfDetail levelOfDetail =
00448 Log::MaximumLevelOfDetailForMessage ) ;
00449
00450
00451
00452
00453 protected:
00454
00455
00457 static LogSource * InfoLogSource ;
00458
00459
00461 static LogSource * TraceLogSource ;
00462
00463
00465 static LogSource * DebugLogSource ;
00466
00467
00469 static LogSource * WarningLogSource ;
00470
00471
00473 static LogSource * ErrorLogSource ;
00474
00475
00477 static LogSource * FatalLogSource ;
00478
00479
00481 static LogSource * LogrootLogSource ;
00482
00483
00485 static LogTransport * Transport ;
00486
00487
00488
00494 static LogListener * Listener ;
00495
00496
00502 static LogAggregator * Aggregator ;
00503
00504
00510 static std::string FullExecutablePath ;
00511
00512
00514 static std::string SourceName ;
00515
00516
00517
00519 LogPlug()
00520
00521 #ifndef CEYLAN_RUNS_ON_WINDOWS
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531 __attribute__ ((noreturn))
00532 #endif // CEYLAN_RUNS_ON_WINDOWS
00533 ;
00534
00535
00537 virtual ~LogPlug() throw() ;
00538
00539
00540
00541 private:
00542
00543
00552 LogPlug( const LogPlug & source ) ;
00553
00554
00563 LogPlug & operator = ( const LogPlug & source ) ;
00564
00565
00566 } ;
00567
00568 }
00569
00570 }
00571
00572
00573
00574 #endif // CEYLAN_LOG_PLUG_H_
00575