-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use logging categories #7052
Use logging categories #7052
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -949,7 +949,8 @@ void SessionImpl::on_new_flx_subscription_set(int64_t new_version) | |
// check is that we have completed the IDENT message handshake and have not yet received an ERROR | ||
// message to call ensure_enlisted_to_send(). | ||
if (m_state == State::Active && m_ident_message_sent && !m_error_message_received) { | ||
logger.trace("Requesting QUERY change message for new subscription set version %1", new_version); | ||
logger.trace(util::LogCategory::sync, "Requesting QUERY change message for new subscription set version %1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not session? Isn't it session's impl essentially? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be appropriate to use just |
||
new_version); | ||
ensure_enlisted_to_send(); | ||
} | ||
} | ||
|
@@ -1910,7 +1911,8 @@ ClientImpl::Connection::Connection(ClientImpl& client, connection_ident_type ide | |
Optional<std::string> ssl_trust_certificate_path, | ||
std::function<SSLVerifyCallback> ssl_verify_callback, | ||
Optional<ProxyConfig> proxy_config, ReconnectInfo reconnect_info) | ||
: logger_ptr{std::make_shared<util::PrefixLogger>(make_logger_prefix(ident), client.logger_ptr)} // Throws | ||
: logger_ptr{std::make_shared<util::PrefixLogger>(util::LogCategory::session, make_logger_prefix(ident), | ||
client.logger_ptr)} // Throws | ||
, logger{*logger_ptr} | ||
, m_client{client} | ||
, m_verify_servers_ssl_certificate{verify_servers_ssl_certificate} // DEPRECATED | ||
|
@@ -1967,7 +1969,7 @@ void ClientImpl::Connection::resume_active_sessions() | |
|
||
void ClientImpl::Connection::on_idle() | ||
{ | ||
logger.debug("Destroying connection object"); | ||
logger.debug(util::LogCategory::session, "Destroying connection object"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. connection can serve multiple session. Maybe introduce one more category under client for Connection? Otherwise just 'client' would be appropriate i think. @michael-wb what are you thought? |
||
ClientImpl& client = get_client(); | ||
client.remove_connection(*this); | ||
// NOTE: This connection object is now destroyed! | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -465,12 +465,29 @@ void DefaultWebSocketImpl::initiate_websocket_handshake() | |
/// | ||
/// DefaultSocketProvider - default socket provider implementation | ||
/// | ||
class DefaultSocketLogger : public util::Logger { | ||
public: | ||
DefaultSocketLogger(const std::shared_ptr<Logger>& base_logger) noexcept | ||
: Logger(util::LogCategory::network, *base_logger) | ||
, m_base_logger_ptr(base_logger) | ||
{ | ||
} | ||
|
||
protected: | ||
void do_log(const util::LogCategory& category, Level level, const std::string& message) final | ||
{ | ||
Logger::do_log(*m_base_logger_ptr, category, level, message); | ||
} | ||
|
||
private: | ||
std::shared_ptr<Logger> m_base_logger_ptr; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this to logger.hpp and change the name to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
DefaultSocketProvider::DefaultSocketProvider(const std::shared_ptr<util::Logger>& logger, | ||
const std::string user_agent, | ||
const std::shared_ptr<BindingCallbackThreadObserver>& observer_ptr, | ||
AutoStart auto_start) | ||
: m_logger_ptr{logger} | ||
: m_logger_ptr{std::make_shared<DefaultSocketLogger>(logger)} | ||
, m_observer_ptr{observer_ptr} | ||
, m_service{} | ||
, m_random{} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if the s2_logger() was set up with the
query
log category so it doesn't have to be provided every time. (e.g. like a logger subclass that is constructed with a log category)