mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Construct HTTP log message only if needed (#165057)
## Summary Previously we have unconditionally created a debug log message that potentially involved serializing a large response object only to ignore it if the the log level 'debug' is disabled for that logger. With this commit we add a check if the respective level is enabled on the logger before we proceed to construct the log message. ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
parent
34c7a03016
commit
aa27425663
1 changed files with 4 additions and 2 deletions
|
@ -399,8 +399,10 @@ export class HttpServer {
|
|||
const log = this.logger.get('http', 'server', 'response');
|
||||
|
||||
this.handleServerResponseEvent = (request) => {
|
||||
const { message, meta } = getEcsResponseLog(request, this.log);
|
||||
log.debug(message!, meta);
|
||||
if (log.isLevelEnabled('debug')) {
|
||||
const { message, meta } = getEcsResponseLog(request, this.log);
|
||||
log.debug(message!, meta);
|
||||
}
|
||||
};
|
||||
|
||||
this.server.events.on('response', this.handleServerResponseEvent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue