Using A Library

edit

When the client receives a function for the log: config value, it expects that the function is a constructor for a custom log class. This is the simplest way to integrate other logging libraries into the elasticsearch client at this time. The contract for this Log class is pretty straight-forward. See our implementation for additional details.

new Constructor(config)

edit

config

The object that was passed to the client constructor, use to determine the log level.

error(error)

edit

error

Error — The error that occurred

warning(message)

edit

message

String — The message to be logged

info(message)

edit

message

String — The message to be logged

debug(message)

edit

message

String — The message to be logged

trace(httpMethod, requestUrl, requestBody, responseBody, responseStatus)

edit

Called after every HTTP request.

httpMethod

String — The request’s HTTP method

requestUrl

Object, String — Depending on the connector in use, this will either be a url string or the object passed to node’s http.request.

requestBody

String, false-y — The body of the http request, if the body is false-y no body was sent

responseStatus

Integer, false-y — The HTTP response status