Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Example project

To help you get started with using Better Stack in your Rack projects, we have prepared a simple program that showcases the usage of Logtail logger.

Download and install the example project

You can download the example project from GitHub directly or you can clone it to a select directory. Make sure you are in the projects directory and run the following command:

bundle install

This will install all dependencies listed in the Gemfile.lock file.

Then replace <source_token> and <ingesting_host> in config.ru with your actual source token and ingesting host which you can find by going to Better Stack Telemetry -> Source -> Configure.

http_io_device = Logtail::LogDevices::HTTP.new("<source_token>", ingesting_host: "<ingesting_host>")

Run the example project

To run the example application, run the following command:

rackup

This will start a local server and you visit http://127.0.0.1:9292 in your browser.

You should see the following output:

All done!
Log into your Logtail account to check your logs.

This will create a total of 4 different logs. You can review these logs in Better Stack.

You can visit any path on the server to see the request path being logged in context. Visit /error to see an example exception being logged.