forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccess_log_base.cc
34 lines (30 loc) · 1.15 KB
/
access_log_base.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "source/extensions/access_loggers/common/access_log_base.h"
#include "source/common/http/header_map_impl.h"
#include "source/common/singleton/const_singleton.h"
namespace Envoy {
namespace Extensions {
namespace AccessLoggers {
namespace Common {
void ImplBase::log(const Http::RequestHeaderMap* request_headers,
const Http::ResponseHeaderMap* response_headers,
const Http::ResponseTrailerMap* response_trailers,
const StreamInfo::StreamInfo& stream_info) {
if (!request_headers) {
request_headers = Http::StaticEmptyHeaders::get().request_headers.get();
}
if (!response_headers) {
response_headers = Http::StaticEmptyHeaders::get().response_headers.get();
}
if (!response_trailers) {
response_trailers = Http::StaticEmptyHeaders::get().response_trailers.get();
}
if (filter_ &&
!filter_->evaluate(stream_info, *request_headers, *response_headers, *response_trailers)) {
return;
}
return emitLog(*request_headers, *response_headers, *response_trailers, stream_info);
}
} // namespace Common
} // namespace AccessLoggers
} // namespace Extensions
} // namespace Envoy