These files work together to extract useful data from a Rails application and publish it through a ZeroMQ PUSH socket as JSON.
The code in application_controller.rb will automatically log every request and exception, but you're free to log other things. If you're inside a controller, you can use log_message(atts) or emit_event(atts). These controller methods simply delegate to the global object $ZMQ_LOGGER, which responds to log(atts)
and emit(atts)
. They add the data.http.request-id
key if not already present.
The difference between logging and emitting is somewhat blurry, but I like to think of log messages as something that will be saved somewhere and emitted events as ephemeral.
All attributes are expected to use strings as keys. If you use symbols, you may experience issues.
You may use these files as you wish, with one exception: You may not package them into a reusable library and publish it. This is not easily reusable code, and any attempt to make it into a pre-packaged library will result