LogNexis Ruby SDK
The official Ruby tracking SDK for LogNexis — the lightweight, real-time API monitoring, analytics, and observability platform.
Website: https://lognexis.online
Documentation: https://lognexis.online/docs
What it does
Automatically capture API request logs, HTTP errors, latency metrics, and real-world performance without blocking your application threads. It works universally across any Rack-based framework.
Installation
Add this line to your application's Gemfile:
gem 'lognexis-ruby', '>= 1.0'
And then execute:
$ bundle install
Or install it yourself via:
$ gem install lognexis-ruby
Quick Start (Ruby on Rails)
In your config/application.rb or inside a new initializer like config/initializers/lognexis.rb:
require 'lognexis'
Rails.application.config.middleware.use LogNexis::RackMiddleware, api_key: "YOUR_LOGNEXIS_API_KEY"
Quick Start (Sinatra / Rack)
In your config.ru or main app file:
require 'sinatra'
require 'lognexis'
use LogNexis::RackMiddleware, api_key: "YOUR_LOGNEXIS_API_KEY"
get '/' do
'Hello World'
end
Manual Usage (Background Jobs / Services)
If you aren't using a web server or want to log background jobs:
require 'lognexis'
client = LogNexis::Client.new("YOUR_LOGNEXIS_API_KEY")
client.capture({
endpoint: "/custom-job/user-sync",
method: "POST",
statusCode: 200,
latency: 145.5
})
How it works
This SDK uses Ruby's built-in Net::HTTP inside of a non-blocking Thread.new block. It operates in a completely "fire-and-forget" manner, meaning that even if the LogNexis servers were to go down, your application will NEVER crash and your API response times will NEVER be slowed down by this SDK.