CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Logger.h
Go to the documentation of this file.
1 #ifndef CONDCORE_DBCOMMON_LOGGER_H
2 #define CONDCORE_DBCOMMON_LOGGER_H
3 
5 #include <string>
6 
7 //
8 // Package: CondCore/DBCommon
9 // Class : Logger
10 //
13 //
14 // Author: Zhen Xie
15 //
16 
17 namespace coral{
18  //class ISchema;
19  class IQuery;
20 }
21 namespace cond{
22  class UserLogInfo;
23  class LogDBEntry;
24  class SequenceManager;
25  class Logger{
26  public:
27  explicit Logger(DbSession& sessionHandle);
28  ~Logger();
29 
30  void connect( const std::string& logConnectionString, bool readOnly=false );
31  //NB. for oracle only schema owner can do this
32  void createLogDBIfNonExist();
33  //
34  //the current local time will be registered as execution time
35  // payloadName and containerName are also logged but they are deduced from payloadToken
36  void logOperationNow(
37  const cond::UserLogInfo& userlogInfo,
38  const std::string& destDB,
39  const std::string& payloadToken,
40  const std::string& payloadClass,
41  const std::string& iovtag,
42  const std::string& iovtimetype,
43  unsigned int payloadIdx,
44  unsigned long long lastSince
45  );
46  //
47  //the current local time will be registered as execution time
48  //
49  // payloadName and containerName are also logged but they are deduced from payloadToken
51  const cond::UserLogInfo& userlogInfo,
52  const std::string& destDB,
53  const std::string& payloadToken,
54  const std::string& payloadClass,
55  const std::string& iovtag,
56  const std::string& iovtimetype,
57  unsigned int payloadIdx,
58  unsigned long long lastSince,
59  const std::string& exceptionMessage
60  );
61  //
62  // Here we query the log for the last entry for these payloads.
63  // Parameter LogDBEntry& result is both input and output
64  // As input, it defines query condition.
65  // Last: in the sense of max rowid satisfies the requirement
66  // Note: if empty logentry is given, the absolute max is returned which
67  // normally is useless.
68  // return empty struct is no result found
69  //
70  void LookupLastEntryByProvenance( const std::string& provenance,
71  LogDBEntry& logentry,
72  bool filterFailedOp=true) const;
73  //
74  // Here we query the log for the last entry for these payloads.
75  // Parameter LogDBEntry& result is both input and output
76  // As input, it defines query condition.
77  // Last: in the sense of max rowid satisfies the requirement
78  // Note: if empty logentry is given, the absolute max is returned which
79  // normally is useless.
80  //
81  void LookupLastEntryByTag( const std::string& iovtag,
82  LogDBEntry& logentry,
83  bool filterFailedOp=true) const;
84 
85  void LookupLastEntryByTag( const std::string& iovtag,
86  const std::string & connectionStr,
87  LogDBEntry& logentry,
88  bool filterFailedOp=true) const;
89 
90  private:
91  void insertLogRecord(unsigned long long logId,
92  const std::string& utctime,
93  const std::string& destDB,
94  const std::string& payloadToken,
95  const std::string& payloadClass,
96  const cond::UserLogInfo& userLogInfo,
97  const std::string& iovtag,
98  const std::string& iovtimetype,
99  unsigned int payloadIdx,
100  unsigned long long lastSince,
101  const std::string& exceptionMessage);
102 
104  //coral::ISchema& m_schema;
105  bool m_locked;
106  coral::IQuery* m_statusEditorHandle;
109  };
110 }//ns cond
111 #endif
SequenceManager * m_sequenceManager
Definition: Logger.h:107
bool m_locked
Definition: Logger.h:105
void logFailedOperationNow(const cond::UserLogInfo &userlogInfo, const std::string &destDB, const std::string &payloadToken, const std::string &payloadClass, const std::string &iovtag, const std::string &iovtimetype, unsigned int payloadIdx, unsigned long long lastSince, const std::string &exceptionMessage)
Definition: Logger.cc:138
void connect(const std::string &logConnectionString, bool readOnly=false)
Definition: Logger.cc:41
DbSession m_sessionHandle
Definition: Logger.h:103
void LookupLastEntryByProvenance(const std::string &provenance, LogDBEntry &logentry, bool filterFailedOp=true) const
Definition: Logger.cc:165
void logOperationNow(const cond::UserLogInfo &userlogInfo, const std::string &destDB, const std::string &payloadToken, const std::string &payloadClass, const std::string &iovtag, const std::string &iovtimetype, unsigned int payloadIdx, unsigned long long lastSince)
Definition: Logger.cc:112
coral::IQuery * m_statusEditorHandle
Definition: Logger.h:106
void createLogDBIfNonExist()
Definition: Logger.cc:48
void LookupLastEntryByTag(const std::string &iovtag, LogDBEntry &logentry, bool filterFailedOp=true) const
Definition: Logger.cc:289
bool m_logTableExists
Definition: Logger.h:108
Logger(DbSession &sessionHandle)
Definition: Logger.cc:33
void insertLogRecord(unsigned long long logId, const std::string &utctime, const std::string &destDB, const std::string &payloadToken, const std::string &payloadClass, const cond::UserLogInfo &userLogInfo, const std::string &iovtag, const std::string &iovtimetype, unsigned int payloadIdx, unsigned long long lastSince, const std::string &exceptionMessage)
Definition: Logger.cc:295