Skip to content
Snippets Groups Projects
Unverified Commit 237859d8 authored by Adrien Béraud's avatar Adrien Béraud Committed by GitHub
Browse files

Merge branch 'master' into push_notifications_client

parents 37a9a3d9 24dec068
Branches
No related tags found
No related merge requests found
...@@ -214,7 +214,6 @@ public: ...@@ -214,7 +214,6 @@ public:
virtual std::vector<SockAddr> getPublicAddress(sa_family_t family = 0) = 0; virtual std::vector<SockAddr> getPublicAddress(sa_family_t family = 0) = 0;
Logger DHT_LOG;
/** /**
* Enable or disable logging of DHT internal messages * Enable or disable logging of DHT internal messages
*/ */
...@@ -228,7 +227,8 @@ public: ...@@ -228,7 +227,8 @@ public:
/** /**
* Only print logs related to the given InfoHash (if given), or disable filter (if zeroes). * Only print logs related to the given InfoHash (if given), or disable filter (if zeroes).
*/ */
virtual void setLogFilter(const InfoHash& f) { virtual void setLogFilter(const InfoHash& f)
{
DHT_LOG.setFilter(f); DHT_LOG.setFilter(f);
} }
...@@ -244,9 +244,11 @@ public: ...@@ -244,9 +244,11 @@ public:
*/ */
virtual void resubscribe(const unsigned token) = 0; virtual void resubscribe(const unsigned token) = 0;
#endif // OPENDHT_PUSH_NOTIFICATIONS #endif // OPENDHT_PUSH_NOTIFICATIONS
protected: protected:
bool logFilerEnable_ {}; bool logFilerEnable_ {};
InfoHash logFiler_ {}; InfoHash logFiler_ {};
Logger DHT_LOG;
}; };
} // namespace dht } // namespace dht
...@@ -322,6 +322,22 @@ public: ...@@ -322,6 +322,22 @@ public:
} }
#endif // OPENDHT_PUSH_NOTIFICATIONS #endif // OPENDHT_PUSH_NOTIFICATIONS
void setLoggers(LogMethod error = NOLOG, LogMethod warn = NOLOG, LogMethod debug = NOLOG)
{
DHT_LOG.DEBUG = debug;
DHT_LOG.WARN = warn;
DHT_LOG.ERR = error;
dht_->setLoggers(std::forward<LogMethod>(error), std::forward<LogMethod>(warn), std::forward<LogMethod>(debug));
}
/**
* Only print logs related to the given InfoHash (if given), or disable filter (if zeroes).
*/
void setLogFilter(const InfoHash& f) {
DHT_LOG.setFilter(f);
dht_->setLogFilter(f);
}
private: private:
std::unique_ptr<DhtInterface> dht_; std::unique_ptr<DhtInterface> dht_;
// prevent copy // prevent copy
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment