From ce71e65aee625117cf55f7cf0a2f293088662650 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 8 Nov 2014 10:51:56 +0900 Subject: [PATCH] nghttpx: Replace WARNING with WARN for consistency --- src/shrpx.cc | 46 ++++++++++++++++++------------------ src/shrpx_config.cc | 2 +- src/shrpx_connect_blocker.cc | 2 +- src/shrpx_downstream.cc | 2 +- src/shrpx_http2_session.cc | 18 +++++++------- src/shrpx_http2_upstream.cc | 20 ++++++++-------- src/shrpx_log.cc | 2 +- src/shrpx_log.h | 2 +- src/shrpx_spdy_upstream.cc | 14 +++++------ src/shrpx_ssl.cc | 9 ++++--- 10 files changed, 58 insertions(+), 59 deletions(-) diff --git a/src/shrpx.cc b/src/shrpx.cc index c2f8f658..7a839f85 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -195,8 +195,8 @@ evconnlistener* create_evlistener(ListenHandler *handler, int family) return new_evlistener(handler, fd); } - LOG(WARNING) << "Port was changed between old binary (" << port - << ") and new binary (" << get_config()->port << ")"; + LOG(WARN) << "Port was changed between old binary (" << port + << ") and new binary (" << get_config()->port << ")"; close(fd); } } @@ -255,8 +255,8 @@ evconnlistener* create_evlistener(ListenHandler *handler, int family) } if(!rp) { - LOG(WARNING) << "Listening " << (family == AF_INET ? "IPv4" : "IPv6") - << " socket failed"; + LOG(WARN) << "Listening " << (family == AF_INET ? "IPv4" : "IPv6") + << " socket failed"; freeaddrinfo(res); @@ -270,7 +270,7 @@ evconnlistener* create_evlistener(ListenHandler *handler, int family) freeaddrinfo(res); if(rv != 0) { - LOG(WARNING) << gai_strerror(rv); + LOG(WARN) << gai_strerror(rv); close(fd); @@ -321,10 +321,10 @@ void save_pid() if(chown(get_config()->pid_file.get(), get_config()->uid, get_config()->gid) == -1) { auto error = errno; - LOG(WARNING) << "Changing owner of pid file " - << get_config()->pid_file.get() - << " failed: " - << strerror(error); + LOG(WARN) << "Changing owner of pid file " + << get_config()->pid_file.get() + << " failed: " + << strerror(error); } } } @@ -1338,7 +1338,7 @@ int main(int argc, char **argv) break; case 'n': #ifdef NOTHREADS - LOG(WARNING) << "Threading disabled at build time, no threads created."; + LOG(WARN) << "Threading disabled at build time, no threads created."; #else cmdcfgs.emplace_back(SHRPX_OPT_WORKERS, optarg); #endif // NOTHREADS @@ -1664,15 +1664,15 @@ int main(int argc, char **argv) fchown(worker_config->accesslog_fd, get_config()->uid, get_config()->gid) == -1) { auto error = errno; - LOG(WARNING) << "Changing owner of access log file failed: " - << strerror(error); + LOG(WARN) << "Changing owner of access log file failed: " + << strerror(error); } if(worker_config->errorlog_fd != -1 && fchown(worker_config->errorlog_fd, get_config()->uid, get_config()->gid) == -1) { auto error = errno; - LOG(WARNING) << "Changing owner of error log file failed: " - << strerror(error); + LOG(WARN) << "Changing owner of error log file failed: " + << strerror(error); } } @@ -1691,10 +1691,10 @@ int main(int argc, char **argv) if(get_config()->uid != 0) { if(chown(path, get_config()->uid, get_config()->gid) == -1) { auto error = errno; - LOG(WARNING) << "Changing owner of http2 upstream request header file " - << path - << " failed: " - << strerror(error); + LOG(WARN) << "Changing owner of http2 upstream request header file " + << path + << " failed: " + << strerror(error); } } } @@ -1714,11 +1714,11 @@ int main(int argc, char **argv) if(get_config()->uid != 0) { if(chown(path, get_config()->uid, get_config()->gid) == -1) { auto error = errno; - LOG(WARNING) << "Changing owner of http2 upstream response header file" - << " " - << path - << " failed: " - << strerror(error); + LOG(WARN) << "Changing owner of http2 upstream response header file" + << " " + << path + << " failed: " + << strerror(error); } } } diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 59577e10..547f968c 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -943,7 +943,7 @@ int parse_config(const char *opt, const char *optarg) } if(util::strieq(opt, "conf")) { - LOG(WARNING) << "conf: ignored"; + LOG(WARN) << "conf: ignored"; return 0; } diff --git a/src/shrpx_connect_blocker.cc b/src/shrpx_connect_blocker.cc index a40dc412..3954dae7 100644 --- a/src/shrpx_connect_blocker.cc +++ b/src/shrpx_connect_blocker.cc @@ -78,7 +78,7 @@ void ConnectBlocker::on_failure() sleep_ = std::min(128, sleep_ * 2); - LOG(WARNING) << "connect failure, start sleeping " << sleep_; + LOG(WARN) << "connect failure, start sleeping " << sleep_; timeval t = {sleep_, 0}; diff --git a/src/shrpx_downstream.cc b/src/shrpx_downstream.cc index f781ee82..973bb787 100644 --- a/src/shrpx_downstream.cc +++ b/src/shrpx_downstream.cc @@ -975,7 +975,7 @@ event* init_timer(event_base *evbase, event_callback_fn cb, void *arg) auto timerev = evtimer_new(evbase, cb, arg); if(timerev == nullptr) { - LOG(WARNING) << "timer initialization failed"; + LOG(WARN) << "timer initialization failed"; return nullptr; } diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index c2e54656..c6629122 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -97,7 +97,7 @@ int Http2Session::disconnect() if(fd_ == -1) { fd_ = fd; } else if(fd != fd_) { - SSLOG(WARNING, this) << "fd in bev_ != fd_"; + SSLOG(WARN, this) << "fd in bev_ != fd_"; shutdown(fd, SHUT_WR); close(fd); } @@ -282,7 +282,7 @@ void eventcb(bufferevent *bev, short events, void *ptr) if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&val), sizeof(val)) == -1) { auto error = errno; - SSLOG(WARNING, http2session) + SSLOG(WARN, http2session) << "Setting option TCP_NODELAY failed: errno=" << error; } return; @@ -575,7 +575,7 @@ int htp_hdrs_completecb(http_parser *htp) return 0; } - SSLOG(WARNING, http2session) << "Tunneling failed"; + SSLOG(WARN, http2session) << "Tunneling failed"; http2session->set_state(Http2Session::PROXY_FAILED); return 0; @@ -1314,10 +1314,10 @@ int on_frame_not_send_callback(nghttp2_session *session, int lib_error_code, void *user_data) { auto http2session = static_cast(user_data); - SSLOG(WARNING, http2session) << "Failed to send control frame type=" - << static_cast(frame->hd.type) - << "lib_error_code=" << lib_error_code << ":" - << nghttp2_strerror(lib_error_code); + SSLOG(WARN, http2session) << "Failed to send control frame type=" + << static_cast(frame->hd.type) + << "lib_error_code=" << lib_error_code << ":" + << nghttp2_strerror(lib_error_code); if(frame->hd.type == NGHTTP2_HEADERS && frame->headers.cat == NGHTTP2_HCAT_REQUEST) { // To avoid stream hanging around, flag Downstream::MSG_RESET and @@ -1649,8 +1649,8 @@ int Http2Session::consume(int32_t stream_id, size_t len) rv = nghttp2_session_consume(session_, stream_id, len); if(rv != 0) { - SSLOG(WARNING, this) << "nghttp2_session_consume() returned error: " - << nghttp2_strerror(rv); + SSLOG(WARN, this) << "nghttp2_session_consume() returned error: " + << nghttp2_strerror(rv); return -1; } diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index dd6a1e27..bb159717 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -125,8 +125,8 @@ int Http2Upstream::upgrade_upstream(HttpsUpstream *http) settings_payload.size(), nullptr); if(rv != 0) { - ULOG(WARNING, this) << "nghttp2_session_upgrade() returned error: " - << nghttp2_strerror(rv); + ULOG(WARN, this) << "nghttp2_session_upgrade() returned error: " + << nghttp2_strerror(rv); return -1; } pre_upstream_.reset(http); @@ -603,10 +603,10 @@ int on_frame_not_send_callback(nghttp2_session *session, int lib_error_code, void *user_data) { auto upstream = static_cast(user_data); - ULOG(WARNING, upstream) << "Failed to send control frame type=" - << static_cast(frame->hd.type) - << ", lib_error_code=" << lib_error_code << ":" - << nghttp2_strerror(lib_error_code); + ULOG(WARN, upstream) << "Failed to send control frame type=" + << static_cast(frame->hd.type) + << ", lib_error_code=" << lib_error_code << ":" + << nghttp2_strerror(lib_error_code); if(frame->hd.type == NGHTTP2_HEADERS && frame->headers.cat == NGHTTP2_HCAT_RESPONSE) { // To avoid stream hanging around, issue RST_STREAM. @@ -924,8 +924,8 @@ void downstream_eventcb(bufferevent *bev, short events, void *ptr) int val = 1; if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&val), sizeof(val)) == -1) { - DCLOG(WARNING, dconn) << "Setting option TCP_NODELAY failed: errno=" - << errno; + DCLOG(WARN, dconn) << "Setting option TCP_NODELAY failed: errno=" + << errno; } return; @@ -1425,8 +1425,8 @@ int Http2Upstream::consume(int32_t stream_id, size_t len) rv = nghttp2_session_consume(session_, stream_id, len); if(rv != 0) { - ULOG(WARNING, this) << "nghttp2_session_consume() returned error: " - << nghttp2_strerror(rv); + ULOG(WARN, this) << "nghttp2_session_consume() returned error: " + << nghttp2_strerror(rv); return -1; } diff --git a/src/shrpx_log.cc b/src/shrpx_log.cc index c9c51e6a..f6062a34 100644 --- a/src/shrpx_log.cc +++ b/src/shrpx_log.cc @@ -84,7 +84,7 @@ int severity_to_syslog_level(int severity) return LOG_INFO; case(NOTICE): return LOG_NOTICE; - case(WARNING): + case(WARN): return LOG_WARNING; case(ERROR): return LOG_ERR; diff --git a/src/shrpx_log.h b/src/shrpx_log.h index baf56fe2..1166d3b0 100644 --- a/src/shrpx_log.h +++ b/src/shrpx_log.h @@ -71,7 +71,7 @@ class Downstream; (Log(SEVERITY, __FILE__, __LINE__) << "[DHTTP2:" << HTTP2 << "] ") enum SeverityLevel { - INFO, NOTICE, WARNING, ERROR, FATAL + INFO, NOTICE, WARN, ERROR, FATAL }; class Log { diff --git a/src/shrpx_spdy_upstream.cc b/src/shrpx_spdy_upstream.cc index 06c76eca..9fdefc08 100644 --- a/src/shrpx_spdy_upstream.cc +++ b/src/shrpx_spdy_upstream.cc @@ -384,9 +384,9 @@ void on_ctrl_not_send_callback(spdylay_session *session, int error_code, void *user_data) { auto upstream = static_cast(user_data); - ULOG(WARNING, upstream) << "Failed to send control frame type=" << type - << ", error_code=" << error_code << ":" - << spdylay_strerror(error_code); + ULOG(WARN, upstream) << "Failed to send control frame type=" << type + << ", error_code=" << error_code << ":" + << spdylay_strerror(error_code); if(type == SPDYLAY_SYN_REPLY) { // To avoid stream hanging around, issue RST_STREAM. auto stream_id = frame->syn_reply.stream_id; @@ -658,8 +658,8 @@ void spdy_downstream_eventcb(bufferevent *bev, short events, void *ptr) int val = 1; if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&val), sizeof(val)) == -1) { - DCLOG(WARNING, dconn) << "Setting option TCP_NODELAY failed: errno=" - << errno; + DCLOG(WARN, dconn) << "Setting option TCP_NODELAY failed: errno=" + << errno; } return; } @@ -1134,8 +1134,8 @@ int SpdyUpstream::consume(int32_t stream_id, size_t len) rv = spdylay_session_consume(session_, stream_id, len); if(rv != 0) { - ULOG(WARNING, this) << "spdylay_session_consume() returned error: " - << spdylay_strerror(rv); + ULOG(WARN, this) << "spdylay_session_consume() returned error: " + << spdylay_strerror(rv); return -1; } diff --git a/src/shrpx_ssl.cc b/src/shrpx_ssl.cc index a29152fd..ba0e018f 100644 --- a/src/shrpx_ssl.cc +++ b/src/shrpx_ssl.cc @@ -405,8 +405,8 @@ SSL_CTX* create_ssl_client_context() SSL_CTX_set_mode(ssl_ctx, SSL_MODE_RELEASE_BUFFERS); if(SSL_CTX_set_default_verify_paths(ssl_ctx) != 1) { - LOG(WARNING) << "Could not load system trusted ca certificates: " - << ERR_error_string(ERR_get_error(), nullptr); + LOG(WARN) << "Could not load system trusted ca certificates: " + << ERR_error_string(ERR_get_error(), nullptr); } if(get_config()->cacert) { @@ -481,8 +481,7 @@ ClientHandler* accept_connection rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&val), sizeof(val)); if(rv == -1) { - LOG(WARNING) << "Setting option TCP_NODELAY failed: errno=" - << errno; + LOG(WARN) << "Setting option TCP_NODELAY failed: errno=" << errno; } SSL *ssl = nullptr; bufferevent *bev; @@ -634,7 +633,7 @@ void get_altnames(X509 *cert, } X509_NAME *subjectname = X509_get_subject_name(cert); if(!subjectname) { - LOG(WARNING) << "Could not get X509 name object from the certificate."; + LOG(WARN) << "Could not get X509 name object from the certificate."; return; } int lastpos = -1;