mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-08 11:08:52 +08:00
Merge pull request #1990 from nghttp2/prefer-file-name-macro
nghttpx: Prefer __FILE_NAME__ if defined
This commit is contained in:
@@ -45,43 +45,53 @@ using namespace nghttp2;
|
|||||||
|
|
||||||
#define LOG_ENABLED(SEVERITY) (ENABLE_LOG && shrpx::Log::log_enabled(SEVERITY))
|
#define LOG_ENABLED(SEVERITY) (ENABLE_LOG && shrpx::Log::log_enabled(SEVERITY))
|
||||||
|
|
||||||
#define LOG(SEVERITY) shrpx::Log(SEVERITY, __FILE__, __LINE__)
|
#ifdef __FILE_NAME__
|
||||||
|
# define NGHTTP2_FILE_NAME __FILE_NAME__
|
||||||
|
#else // !__FILE_NAME__
|
||||||
|
# define NGHTTP2_FILE_NAME __FILE__
|
||||||
|
#endif // !__FILE_NAME__
|
||||||
|
|
||||||
|
#define LOG(SEVERITY) shrpx::Log(SEVERITY, NGHTTP2_FILE_NAME, __LINE__)
|
||||||
|
|
||||||
// Listener log
|
// Listener log
|
||||||
#define LLOG(SEVERITY, LISTEN) \
|
#define LLOG(SEVERITY, LISTEN) \
|
||||||
(shrpx::Log(SEVERITY, __FILE__, __LINE__) << "[LISTEN:" << LISTEN << "] ")
|
(shrpx::Log(SEVERITY, NGHTTP2_FILE_NAME, __LINE__) \
|
||||||
|
<< "[LISTEN:" << LISTEN << "] ")
|
||||||
|
|
||||||
// Worker log
|
// Worker log
|
||||||
#define WLOG(SEVERITY, WORKER) \
|
#define WLOG(SEVERITY, WORKER) \
|
||||||
(shrpx::Log(SEVERITY, __FILE__, __LINE__) << "[WORKER:" << WORKER << "] ")
|
(shrpx::Log(SEVERITY, NGHTTP2_FILE_NAME, __LINE__) \
|
||||||
|
<< "[WORKER:" << WORKER << "] ")
|
||||||
|
|
||||||
// ClientHandler log
|
// ClientHandler log
|
||||||
#define CLOG(SEVERITY, CLIENT_HANDLER) \
|
#define CLOG(SEVERITY, CLIENT_HANDLER) \
|
||||||
(shrpx::Log(SEVERITY, __FILE__, __LINE__) \
|
(shrpx::Log(SEVERITY, NGHTTP2_FILE_NAME, __LINE__) \
|
||||||
<< "[CLIENT_HANDLER:" << CLIENT_HANDLER << "] ")
|
<< "[CLIENT_HANDLER:" << CLIENT_HANDLER << "] ")
|
||||||
|
|
||||||
// Upstream log
|
// Upstream log
|
||||||
#define ULOG(SEVERITY, UPSTREAM) \
|
#define ULOG(SEVERITY, UPSTREAM) \
|
||||||
(shrpx::Log(SEVERITY, __FILE__, __LINE__) << "[UPSTREAM:" << UPSTREAM \
|
(shrpx::Log(SEVERITY, NGHTTP2_FILE_NAME, __LINE__) \
|
||||||
<< "]" \
|
<< "[UPSTREAM:" << UPSTREAM << "] ")
|
||||||
" ")
|
|
||||||
|
|
||||||
// Downstream log
|
// Downstream log
|
||||||
#define DLOG(SEVERITY, DOWNSTREAM) \
|
#define DLOG(SEVERITY, DOWNSTREAM) \
|
||||||
(shrpx::Log(SEVERITY, __FILE__, __LINE__) \
|
(shrpx::Log(SEVERITY, NGHTTP2_FILE_NAME, __LINE__) \
|
||||||
<< "[DOWNSTREAM:" << DOWNSTREAM << "] ")
|
<< "[DOWNSTREAM:" << DOWNSTREAM << "] ")
|
||||||
|
|
||||||
// Downstream connection log
|
// Downstream connection log
|
||||||
#define DCLOG(SEVERITY, DCONN) \
|
#define DCLOG(SEVERITY, DCONN) \
|
||||||
(shrpx::Log(SEVERITY, __FILE__, __LINE__) << "[DCONN:" << DCONN << "] ")
|
(shrpx::Log(SEVERITY, NGHTTP2_FILE_NAME, __LINE__) \
|
||||||
|
<< "[DCONN:" << DCONN << "] ")
|
||||||
|
|
||||||
// Downstream HTTP2 session log
|
// Downstream HTTP2 session log
|
||||||
#define SSLOG(SEVERITY, HTTP2) \
|
#define SSLOG(SEVERITY, HTTP2) \
|
||||||
(shrpx::Log(SEVERITY, __FILE__, __LINE__) << "[DHTTP2:" << HTTP2 << "] ")
|
(shrpx::Log(SEVERITY, NGHTTP2_FILE_NAME, __LINE__) \
|
||||||
|
<< "[DHTTP2:" << HTTP2 << "] ")
|
||||||
|
|
||||||
// Memcached connection log
|
// Memcached connection log
|
||||||
#define MCLOG(SEVERITY, MCONN) \
|
#define MCLOG(SEVERITY, MCONN) \
|
||||||
(shrpx::Log(SEVERITY, __FILE__, __LINE__) << "[MCONN:" << MCONN << "] ")
|
(shrpx::Log(SEVERITY, NGHTTP2_FILE_NAME, __LINE__) \
|
||||||
|
<< "[MCONN:" << MCONN << "] ")
|
||||||
|
|
||||||
namespace shrpx {
|
namespace shrpx {
|
||||||
|
|
||||||
|
|||||||
@@ -357,8 +357,8 @@ int ocsp_resp_cb(SSL *ssl, void *arg) {
|
|||||||
return SSL_TLSEXT_ERR_OK;
|
return SSL_TLSEXT_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto buf =
|
auto buf = static_cast<uint8_t *>(
|
||||||
static_cast<uint8_t *>(CRYPTO_malloc(data->size(), __FILE__, __LINE__));
|
CRYPTO_malloc(data->size(), NGHTTP2_FILE_NAME, __LINE__));
|
||||||
|
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
return SSL_TLSEXT_ERR_OK;
|
return SSL_TLSEXT_ERR_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user