CMS 3D CMS Logo

MessageLoggerDefaults.h
Go to the documentation of this file.
1 #ifndef MessageLogger_MessageLoggerDefaults_h
2 #define MessageLogger_MessageLoggerDefaults_h
3 
4 // -*- C++ -*-
5 //
6 // Package: MessageLogger
7 // Class : MessageLoggerDefaults
8 //
24 //
25 // Original Author: M. Fischler
26 // Created: Tues Jun 14 10:38:19 CST 2007
27 //
28 
29 // Framework include files
30 
32 
33 // system include files
34 
35 #include <string>
36 #include <vector>
37 #include <map>
38 #include <cassert>
39 
40 // Change log
41 //
42 // 6/15/07 mf Original version
43 //
44 // -------------------------------------------------------
45 
46 // user include files
47 
48 // ----------------
49 // Maintenance Tips
50 // ----------------
51 //
52 // When default values change for one job mode of operation or another,
53 // implement that change in the appropriate member function implemented
54 // in HardwiredDefaults.cc. For example, hardwireGridJobMode().
55 //
56 // When a new default is needed, add the item to the struct, and then place
57 // the default value into the appropriate sections of the various member
58 // functions in HardwiredDefaults.cc.
59 // It may be necessary to supply values of that default for each of the modes,
60 // even though the ErrorLogger default is suitable for all the modes but one.
61 //
62 // When the new default is of a type not already being accessed, also add
63 // the accessor method in this header, and implement it in
64 // MessageLoggerDefaults.cc following the pattern shown for existing items
65 
66 namespace edm {
67  namespace service {
68 
70  public:
71  static const int NO_VALUE_SET = -45654;
72 
73  struct Category {
75  int limit;
77  int timespan;
78  Category() : threshold(""), limit(NO_VALUE_SET), reportEvery(NO_VALUE_SET), timespan(NO_VALUE_SET) {}
79  };
80 
81  struct Destination {
83  std::map<std::string, Category> category;
84  std::map<std::string, Category> sev;
86  };
87 
88  // publicly available collections and structures
89 
90  std::vector<std::string> categories;
91  std::vector<std::string> destinations;
92  std::vector<std::string> fwkJobReports;
93  std::vector<std::string> statistics;
94  std::map<std::string, Destination> destination;
95 
96  // access to values set
97 
100 
101  int limit(std::string const& dest, std::string const& cat);
102  int reportEvery(std::string const& dest, std::string const& cat);
103  int timespan(std::string const& dest, std::string const& cat);
104 
105  int sev_limit(std::string const& dest, std::string const& sev);
106  int sev_reportEvery(std::string const& dest, std::string const& sev);
107  int sev_timespan(std::string const& dest, std::string const& sev);
108 
109  // Modes with hardwired defaults
110 
111  void hardwireGridJobMode();
114  void hardwireNilJobMode();
115 
116  static edm::JobMode mode(std::string const& jm);
117 
118  // ctor
119 
121  // mode-independent defaults
122 
123  // mode-dependent defaults
124  switch (mode) {
125  // GridJobMode: Intended for automated batch-like processing, in which
126  // the output stream for cerr is routed to an apropro
127  // file. LogInfo messages are enabled, and at least
128  // one such message is delivered from the framework per
129  // event, so this mode is not suitable for many-Hz light
130  // event processing.
131  case GridJobMode:
133  break;
136  break;
137  case AnalysisJobMode:
139  break;
140  case NilJobMode:
142  break;
143  default:
144  // this should never happen! No user error can get here.
145  bool Invalid_JobMode_in_ctor_of_MessageLoggerDefaults = false;
146  assert(Invalid_JobMode_in_ctor_of_MessageLoggerDefaults);
147  } // end of switch on mode
148  }
149  };
150 
151  } // end of namespace service
152 } // end of namespace edm
153 
154 #endif // MessageLogger_MessageLoggerDefaults_h
std::map< std::string, Destination > destination
std::vector< std::string > fwkJobReports
std::vector< std::string > statistics
std::string output(std::string const &dest)
std::vector< std::string > destinations
def cat(path)
Definition: eostools.py:401
int sev_reportEvery(std::string const &dest, std::string const &sev)
MessageLoggerDefaults(edm::JobMode mode=GridJobMode)
int sev_limit(std::string const &dest, std::string const &sev)
static edm::JobMode mode(std::string const &jm)
HLT enums.
JobMode
Definition: JobMode.h:15
std::vector< std::string > categories
int sev_timespan(std::string const &dest, std::string const &sev)