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_SOURCE_H_
00028 #define CEYLAN_LOG_SOURCE_H_
00029
00030
00031 #include "CeylanLog.h"
00032 #include "CeylanTextDisplayable.h"
00033
00034 #include <string>
00035
00036
00037
00038 namespace Ceylan
00039 {
00040
00041
00042 namespace Log
00043 {
00044
00045
00046
00047 class LogTransport ;
00048
00049
00063 class CEYLAN_DLL LogSource : public TextDisplayable
00064 {
00065
00066 public:
00067
00068
00076 explicit LogSource( const std::string & name,
00077 LevelOfDetail levelOfDetail
00078 = DefaultLevelOfDetailForSource ) ;
00079
00080
00086 LogSource( const std::string & name, LogTransport & transport,
00087 LevelOfDetail levelOfDetail
00088 = DefaultLevelOfDetailForSource ) ;
00089
00090
00098 explicit LogSource( LogTransport & transport,
00099 LevelOfDetail levelOfDetail
00100 = DefaultLevelOfDetailForSource ) ;
00101
00102
00104 virtual ~LogSource() throw() ;
00105
00106
00107
00113 bool hasChannelName() const ;
00114
00115
00117 void setChannelName( const std::string & channelName ) ;
00118
00119
00121 std::string getChannelName() const ;
00122
00123
00124
00126 void setLevelOfDetail( LevelOfDetail newLevel ) ;
00127
00128
00130 LevelOfDetail getLevelOfDetail() const ;
00131
00132
00133
00155 virtual void send(
00156 const std::string & message,
00157 LevelOfDetail levelOfDetail
00158 = DefaultLevelOfDetailForMessage ) ;
00159
00160
00183 virtual void sendToChannel(
00184 const std::string & channel,
00185 const std::string & message,
00186 LevelOfDetail levelOfDetail = DefaultLevelOfDetailForMessage
00187 ) const ;
00188
00189
00190
00191
00193 virtual void setTransport( LogTransport & newTransport ) ;
00194
00195
00197 virtual LogTransport * getTransport() const ;
00198
00199
00201 virtual bool hasTransport() const ;
00202
00203
00204
00216 virtual const std::string toString(
00217 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00218
00219
00221 static const LevelOfDetail DefaultLevelOfDetailForSource = 10 ;
00222
00223
00224
00225
00226 protected:
00227
00228
00235 virtual void directSend( const std::string & channel,
00236 const std::string & message,
00237 LevelOfDetail levelOfDetail
00238 = DefaultLevelOfDetailForMessage ) const ;
00239
00240
00242 std::string _channelName ;
00243
00244
00246 LevelOfDetail _level ;
00247
00248
00254 virtual void unlinkTransport() ;
00255
00256
00258 LogTransport * _transport ;
00259
00260
00261
00262 private:
00263
00264
00273 LogSource( const LogSource & source ) ;
00274
00275
00284 LogSource & operator = ( const LogSource & source ) ;
00285
00286
00287 } ;
00288
00289
00290 }
00291
00292
00293 }
00294
00295
00296 #endif // CEYLAN_LOG_SOURCE_H_
00297