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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include <ostream>
00041
00042 #include "FWCore/MessageLogger/interface/ELseverityLevel.h"
00043 #include "FWCore/MessageLogger/interface/ELmap.h"
00044
00045
00046
00047
00048
00049
00050 namespace edm
00051 {
00052
00053
00054
00055
00056
00057
00058 typedef std::map< ELstring const, ELseverityLevel::ELsev_ > ELmap;
00059
00060 static
00061 ELmap const & loadMap() {
00062
00063 static ELmap m;
00064
00065
00066 m[ ELzeroSeverity.getSymbol() ] = ELseverityLevel::ELsev_zeroSeverity
00067 , m[ ELzeroSeverity.getName() ] = ELseverityLevel::ELsev_zeroSeverity
00068 , m[ ELzeroSeverity.getInputStr() ] = ELseverityLevel::ELsev_zeroSeverity
00069 , m[ ELzeroSeverity.getVarName() ] = ELseverityLevel::ELsev_zeroSeverity
00070 ;
00071
00072 m[ ELincidental.getSymbol() ] = ELseverityLevel::ELsev_incidental
00073 , m[ ELincidental.getName() ] = ELseverityLevel::ELsev_incidental
00074 , m[ ELincidental.getInputStr() ] = ELseverityLevel::ELsev_incidental
00075 , m[ ELincidental.getVarName() ] = ELseverityLevel::ELsev_incidental
00076 ;
00077
00078 m[ ELsuccess.getSymbol() ] = ELseverityLevel::ELsev_success
00079 , m[ ELsuccess.getName() ] = ELseverityLevel::ELsev_success
00080 , m[ ELsuccess.getInputStr() ] = ELseverityLevel::ELsev_success
00081 , m[ ELsuccess.getVarName() ] = ELseverityLevel::ELsev_success
00082 ;
00083
00084 m[ ELinfo.getSymbol() ] = ELseverityLevel::ELsev_info
00085 , m[ ELinfo.getName() ] = ELseverityLevel::ELsev_info
00086 , m[ ELinfo.getInputStr() ] = ELseverityLevel::ELsev_info
00087 , m[ ELinfo.getVarName() ] = ELseverityLevel::ELsev_info
00088 ;
00089
00090 m[ ELwarning.getSymbol() ] = ELseverityLevel::ELsev_warning
00091 , m[ ELwarning.getName() ] = ELseverityLevel::ELsev_warning
00092 , m[ ELwarning.getInputStr() ] = ELseverityLevel::ELsev_warning
00093 , m[ ELwarning.getVarName() ] = ELseverityLevel::ELsev_warning
00094 ;
00095
00096 m[ ELwarning2.getSymbol() ] = ELseverityLevel::ELsev_warning2
00097 , m[ ELwarning2.getName() ] = ELseverityLevel::ELsev_warning2
00098 , m[ ELwarning2.getInputStr() ] = ELseverityLevel::ELsev_warning2
00099 , m[ ELwarning2.getVarName() ] = ELseverityLevel::ELsev_warning2
00100 ;
00101
00102 m[ ELerror.getSymbol() ] = ELseverityLevel::ELsev_error
00103 , m[ ELerror.getName() ] = ELseverityLevel::ELsev_error
00104 , m[ ELerror.getInputStr() ] = ELseverityLevel::ELsev_error
00105 , m[ ELerror.getVarName() ] = ELseverityLevel::ELsev_error
00106 ;
00107
00108 m[ ELerror2.getSymbol() ] = ELseverityLevel::ELsev_error2
00109 , m[ ELerror2.getName() ] = ELseverityLevel::ELsev_error2
00110 , m[ ELerror2.getInputStr() ] = ELseverityLevel::ELsev_error2
00111 , m[ ELerror2.getVarName() ] = ELseverityLevel::ELsev_error2
00112 ;
00113
00114 m[ ELnextEvent.getSymbol() ] = ELseverityLevel::ELsev_next
00115 , m[ ELnextEvent.getName() ] = ELseverityLevel::ELsev_next
00116 , m[ ELnextEvent.getInputStr() ] = ELseverityLevel::ELsev_next
00117 , m[ ELnextEvent.getVarName() ] = ELseverityLevel::ELsev_next
00118 ;
00119
00120 m[ ELunspecified.getSymbol() ] = ELseverityLevel::ELsev_unspecified
00121 , m[ ELunspecified.getName() ] = ELseverityLevel::ELsev_unspecified
00122 , m[ ELunspecified.getInputStr() ] = ELseverityLevel::ELsev_unspecified
00123 , m[ ELunspecified.getVarName() ] = ELseverityLevel::ELsev_unspecified
00124 ;
00125
00126 m[ ELsevere.getSymbol() ] = ELseverityLevel::ELsev_severe
00127 , m[ ELsevere.getName() ] = ELseverityLevel::ELsev_severe
00128 , m[ ELsevere.getInputStr() ] = ELseverityLevel::ELsev_severe
00129 , m[ ELsevere.getVarName() ] = ELseverityLevel::ELsev_severe
00130 ;
00131
00132 m[ ELsevere2.getSymbol() ] = ELseverityLevel::ELsev_severe2
00133 , m[ ELsevere2.getName() ] = ELseverityLevel::ELsev_severe2
00134 , m[ ELsevere2.getInputStr() ] = ELseverityLevel::ELsev_severe2
00135 , m[ ELsevere2.getVarName() ] = ELseverityLevel::ELsev_severe2
00136 ;
00137
00138 m[ ELabort.getSymbol() ] = ELseverityLevel::ELsev_abort
00139 , m[ ELabort.getName() ] = ELseverityLevel::ELsev_abort
00140 , m[ ELabort.getInputStr() ] = ELseverityLevel::ELsev_abort
00141 , m[ ELabort.getVarName() ] = ELseverityLevel::ELsev_abort
00142 ;
00143
00144 m[ ELfatal.getSymbol() ] = ELseverityLevel::ELsev_fatal
00145 , m[ ELfatal.getName() ] = ELseverityLevel::ELsev_fatal
00146 , m[ ELfatal.getInputStr() ] = ELseverityLevel::ELsev_fatal
00147 , m[ ELfatal.getVarName() ] = ELseverityLevel::ELsev_fatal
00148 ;
00149
00150 m[ ELhighestSeverity.getSymbol() ] = ELseverityLevel::ELsev_highestSeverity
00151 , m[ ELhighestSeverity.getName() ] = ELseverityLevel::ELsev_highestSeverity
00152 , m[ ELhighestSeverity.getInputStr() ] = ELseverityLevel::ELsev_highestSeverity
00153 , m[ ELhighestSeverity.getVarName() ] = ELseverityLevel::ELsev_highestSeverity
00154 ;
00155
00156 return m;
00157
00158 }
00159
00160
00161
00162
00163
00164
00165 ELseverityLevel::ELseverityLevel( enum ELsev_ lev ) : myLevel( lev ) {
00166
00167 #ifdef ELsevConTRACE
00168 std::cerr << "--- ELseverityLevel " << lev
00169 << " (" << getName() << ")\n"
00170 << std::flush;
00171 #endif
00172
00173 }
00174
00175
00176 ELseverityLevel::ELseverityLevel( ELstring const & s ) {
00177
00178 static ELmap const & m = loadMap();
00179
00180 ELmap::const_iterator i = m.find( s );
00181 myLevel = ( i == m.end() ) ? ELsev_unspecified : i->second;
00182
00183 }
00184
00185
00186 ELseverityLevel::~ELseverityLevel() { ; }
00187
00188
00189
00190
00191
00192
00193 int ELseverityLevel::cmp( ELseverityLevel const & e ) const {
00194 return myLevel - e.myLevel;
00195 }
00196
00197
00198
00199
00200
00201
00202 int ELseverityLevel::getLevel() const {
00203 return myLevel;
00204 }
00205
00206
00207 const ELstring ELseverityLevel::getSymbol() const {
00208 ELstring result;
00209
00210 switch ( myLevel ) {
00211 default : result = "0" ; break;
00212 case ELsev_zeroSeverity : result = "--"; break;
00213 case ELsev_incidental : result = ".."; break;
00214 case ELsev_success : result = "-!"; break;
00215 case ELsev_info : result = "-i"; break;
00216 case ELsev_warning : result = "-w"; break;
00217 case ELsev_warning2 : result = "-W"; break;
00218 case ELsev_error : result = "-e"; break;
00219 case ELsev_error2 : result = "-E"; break;
00220 case ELsev_next : result = "-n"; break;
00221 case ELsev_unspecified : result = "??"; break;
00222 case ELsev_severe : result = "-s"; break;
00223 case ELsev_severe2 : result = "-S"; break;
00224 case ELsev_abort : result = "-A"; break;
00225 case ELsev_fatal : result = "-F"; break;
00226 case ELsev_highestSeverity: result = "!!"; break;
00227 };
00228
00229 return result;
00230 }
00231
00232
00233 const ELstring ELseverityLevel::getName() const {
00234 ELstring result;
00235
00236 switch ( myLevel ) {
00237 default : result = "?no value?"; break;
00238 case ELsev_zeroSeverity : result = "--" ; break;
00239 case ELsev_incidental : result = ".." ; break;
00240 case ELsev_success : result = "Success" ; break;
00241 case ELsev_info : result = "Info" ; break;
00242 case ELsev_warning : result = "Warning" ; break;
00243 case ELsev_warning2 : result = "Warning!" ; break;
00244 case ELsev_error : result = "Error" ; break;
00245 case ELsev_error2 : result = "Error!" ; break;
00246 case ELsev_next : result = "Next" ; break;
00247 case ELsev_unspecified : result = "??" ; break;
00248 case ELsev_severe : result = "System" ; break;
00249 case ELsev_severe2 : result = "Severe!" ; break;
00250 case ELsev_abort : result = "Abort!" ; break;
00251 case ELsev_fatal : result = "Fatal!" ; break;
00252 case ELsev_highestSeverity: result = "!!" ; break;
00253 };
00254
00255 return result;
00256 }
00257
00258
00259 const ELstring ELseverityLevel::getInputStr() const {
00260 ELstring result;
00261
00262 switch ( myLevel ) {
00263 default : result = "?no value?" ; break;
00264 case ELsev_zeroSeverity : result = "ZERO" ; break;
00265 case ELsev_incidental : result = "INCIDENTAL" ; break;
00266 case ELsev_success : result = "DEBUG" ; break;
00267 case ELsev_info : result = "INFO" ; break;
00268 case ELsev_warning : result = "WARNING" ; break;
00269 case ELsev_warning2 : result = "WARNING2" ; break;
00270 case ELsev_error : result = "ERROR" ; break;
00271 case ELsev_error2 : result = "ERROR2" ; break;
00272 case ELsev_next : result = "NEXT" ; break;
00273 case ELsev_unspecified : result = "UNSPECIFIED"; break;
00274 case ELsev_severe : result = "SYSTEM" ; break;
00275 case ELsev_severe2 : result = "SEVERE2" ; break;
00276 case ELsev_abort : result = "ABORT" ; break;
00277 case ELsev_fatal : result = "FATAL" ; break;
00278 case ELsev_highestSeverity: result = "HIGHEST" ; break;
00279 };
00280
00281 return result;
00282 }
00283
00284
00285 const ELstring ELseverityLevel::getVarName() const {
00286 ELstring result;
00287
00288 switch ( myLevel ) {
00289 default : result = "?no value? "; break;
00290 case ELsev_zeroSeverity : result = "ELzeroSeverity "; break;
00291 case ELsev_incidental : result = "ELincidental "; break;
00292 case ELsev_success : result = "ELsuccess "; break;
00293 case ELsev_info : result = "ELinfo "; break;
00294 case ELsev_warning : result = "ELwarning "; break;
00295 case ELsev_warning2 : result = "ELwarning2 "; break;
00296 case ELsev_error : result = "ELerror "; break;
00297 case ELsev_error2 : result = "ELerror2 "; break;
00298 case ELsev_next : result = "ELnextEvent "; break;
00299 case ELsev_unspecified : result = "ELunspecified "; break;
00300 case ELsev_severe : result = "ELsystem "; break;
00301 case ELsev_severe2 : result = "ELsevere2 "; break;
00302 case ELsev_abort : result = "ELabort "; break;
00303 case ELsev_fatal : result = "ELfatal "; break;
00304 case ELsev_highestSeverity: result = "ELhighestSeverity"; break;
00305 };
00306
00307 return result;
00308 }
00309
00310
00311
00312
00313
00314
00315 std::ostream & operator<<( std::ostream & os, const ELseverityLevel & sev ) {
00316 return os << " -" << sev.getName() << "- ";
00317 }
00318
00319
00320
00321
00322
00323
00324
00325 ELseverityLevel const ELzeroSeverityGen() {
00326 static ELseverityLevel const e( ELseverityLevel::ELsev_zeroSeverity );
00327 return e;
00328 }
00329 ELslProxy< ELzeroSeverityGen > const ELzeroSeverity;
00330
00331 ELseverityLevel const ELincidentalGen() {
00332 static ELseverityLevel const e( ELseverityLevel::ELsev_incidental );
00333 return e;
00334 }
00335 ELslProxy< ELincidentalGen > const ELincidental;
00336
00337 ELseverityLevel const ELsuccessGen() {
00338 static ELseverityLevel const e( ELseverityLevel::ELsev_success );
00339 return e;
00340 }
00341 ELslProxy< ELsuccessGen > const ELsuccess;
00342
00343 ELseverityLevel const ELinfoGen() {
00344 static ELseverityLevel const e( ELseverityLevel::ELsev_info );
00345 return e;
00346 }
00347 ELslProxy< ELinfoGen > const ELinfo;
00348
00349 ELseverityLevel const ELwarningGen() {
00350 static ELseverityLevel const e( ELseverityLevel::ELsev_warning );
00351 return e;
00352 }
00353 ELslProxy< ELwarningGen > const ELwarning;
00354
00355 ELseverityLevel const ELwarning2Gen() {
00356 static ELseverityLevel const e( ELseverityLevel::ELsev_warning2 );
00357 return e;
00358 }
00359 ELslProxy< ELwarning2Gen > const ELwarning2;
00360
00361 ELseverityLevel const ELerrorGen() {
00362 static ELseverityLevel const e( ELseverityLevel::ELsev_error );
00363 return e;
00364 }
00365 ELslProxy< ELerrorGen > const ELerror;
00366
00367 ELseverityLevel const ELerror2Gen() {
00368 static ELseverityLevel const e( ELseverityLevel::ELsev_error2 );
00369 return e;
00370 }
00371 ELslProxy< ELerror2Gen > const ELerror2;
00372
00373 ELseverityLevel const ELnextEventGen() {
00374 static ELseverityLevel const e( ELseverityLevel::ELsev_next );
00375 return e;
00376 }
00377 ELslProxy< ELnextEventGen > const ELnextEvent;
00378
00379 ELseverityLevel const ELunspecifiedGen() {
00380 static ELseverityLevel const e( ELseverityLevel::ELsev_unspecified );
00381 return e;
00382 }
00383 ELslProxy< ELunspecifiedGen > const ELunspecified;
00384
00385 ELseverityLevel const ELsevereGen() {
00386 static ELseverityLevel const e( ELseverityLevel::ELsev_severe );
00387 return e;
00388 }
00389 ELslProxy< ELsevereGen > const ELsevere;
00390
00391 ELseverityLevel const ELsevere2Gen() {
00392 static ELseverityLevel const e( ELseverityLevel::ELsev_severe2 );
00393 return e;
00394 }
00395 ELslProxy< ELsevere2Gen > const ELsevere2;
00396
00397 ELseverityLevel const ELabortGen() {
00398 static ELseverityLevel const e( ELseverityLevel::ELsev_abort );
00399 return e;
00400 }
00401 ELslProxy< ELabortGen > const ELabort;
00402
00403 ELseverityLevel const ELfatalGen() {
00404 static ELseverityLevel const e( ELseverityLevel::ELsev_fatal );
00405 return e;
00406 }
00407 ELslProxy< ELfatalGen > const ELfatal;
00408
00409 ELseverityLevel const ELhighestSeverityGen() {
00410 static ELseverityLevel const e( ELseverityLevel::ELsev_highestSeverity );
00411 return e;
00412 }
00413 ELslProxy< ELhighestSeverityGen > const ELhighestSeverity;
00414
00415
00416
00417
00418 }