class

Halite::Logging::JSON

Inherits Halite::Logging::Abstract / Reference / Object

JSON logging format

Instance variables to check Halite::Logging::Abstract.

In JSON format, if you set skip some key, it will return false.

Halite.use("logging", logging: Halite::Logging::JSON.new(skip_request_body: true))
  .get("http://httpbin.org/get")

# Or
Halite.logging(format: "json", skip_request_body: true)
  .get("http://httpbin.org/get")

Log will look like:

{
  "created_at": "2018-08-31T16:53:57+08:00:00",
  "entry":      {
    "request": {
      "body":      "",
      "headers":   {...},
      "method":    "GET",
      "url":       "http://httpbin.org/anything",
      "timestamp": "2018-08-31T16:53:59+08:00:00",
    },
    "response": {
      "body":         false,
      "header":       {...},
      "status_code":  200,
      "http_version": "HTTP/1.1",
      "timestamp":    "2018-08-31T16:53:59+08:00:00",
    },
  },
}

Instance methods

request(request)
Source
response(response)
Source