File indexing completed on 2024-09-07 04:35:24
0001 #ifndef CondCore_CondDB_CoralMsgReporter_h
0002 #define CondCore_CondDB_CoralMsgReporter_h
0003
0004
0005
0006 #include <mutex>
0007 #include <set>
0008 #include "CoralBase/MessageStream.h"
0009
0010 namespace cond {
0011
0012 namespace persistency {
0013
0014 class Logger;
0015
0016 class MsgDispatcher {
0017 public:
0018 MsgDispatcher() = delete;
0019 explicit MsgDispatcher(Logger& logger);
0020 virtual ~MsgDispatcher() {}
0021
0022 void unsubscribe();
0023
0024 bool hasRecipient();
0025 Logger& recipient();
0026
0027 private:
0028 Logger* m_recipient = nullptr;
0029 };
0030
0031 class CoralMsgReporter : public coral::IMsgReporter {
0032 public:
0033
0034 CoralMsgReporter();
0035
0036
0037 ~CoralMsgReporter() override {}
0038
0039
0040 void release() override { delete this; }
0041
0042
0043 coral::MsgLevel outputLevel() const override;
0044
0045
0046 void setOutputLevel(coral::MsgLevel lvl) override;
0047
0048
0049 void report(int lvl, const std::string& src, const std::string& msg) override;
0050
0051 void subscribe(Logger& logger);
0052
0053 private:
0054
0055 std::shared_ptr<MsgDispatcher> m_dispatcher;
0056
0057
0058 coral::MsgLevel m_level;
0059
0060
0061 size_t m_format;
0062
0063
0064 std::recursive_mutex m_mutex;
0065 };
0066
0067 }
0068
0069 }
0070 #endif