From 909e7a235f53f4437b4240425436b0a3d769f713 Mon Sep 17 00:00:00 2001 From: Petr Heinz Date: Tue, 24 Oct 2023 18:16:56 +0200 Subject: [PATCH] Update README.md: simplification (#15) --- README.md | 109 ++++---------------------------------- example-project/README.md | 40 ++++++++++++++ 2 files changed, 50 insertions(+), 99 deletions(-) create mode 100644 example-project/README.md diff --git a/README.md b/README.md index 936b3bd..a5f7e49 100644 --- a/README.md +++ b/README.md @@ -1,111 +1,22 @@ -# 🪵 Logtail Integration For Rack +# [Better Stack](https://betterstack.com/logs) Rack client - [![Logtail ruby dashboard](https://user-images.githubusercontent.com/19272921/154085622-59997d5a-3f91-4bc9-a815-3b8ead16d28d.jpeg)](https://betterstack.com/logtail) +📣 Logtail is now part of Better Stack. [Learn more ⇗](https://betterstack.com/press/introducing-better-stack/) + +[![Better Stack dashboard](https://github.com/logtail/logtail-python/assets/10132717/e2a1196b-7924-4abc-9b85-055e17b5d499)](https://betterstack.com/logs) [![ISC License](https://img.shields.io/badge/license-ISC-ff69b4.svg)](LICENSE.md) [![Gem Version](https://badge.fury.io/rb/logtail-rack.svg)](https://badge.fury.io/rb/logtail-rack) [![Build Status](https://github.com/logtail/logtail-ruby-rack/actions/workflows/main.yml/badge.svg)](https://github.com/logtail/logtail-ruby-rack/actions/workflows/main.yml) -This library integrates the [`logtail` Ruby library](https://github.com/logtail/logtail-ruby) with the [rack](https://github.com/rack/rack) framework, -turning your Rack logs into rich structured events. - -* **Sign-up: [https://logs.betterstack.com](https://logs.betterstack.com)** - -Collect logs directly from your Ruby Rack projects. To start logging Ruby projects explore the [Logtail Ruby library](https://github.com/logtail/logtail-ruby). - -[Better Stack](https://logs.betterstack.com) is a hosted service that centralizes all of your logs into one place. -Allowing for analysis, correlation and filtering with SQL. -Actionable Grafana dashboards and collaboration come built-in. -Logtail works with [any language or platform and any data source](https://betterstack.com/docs/logs/). - -### Features -- Simple integration. -- Support for structured logging and events. -- Automatically captures useful context. -- Performant, light weight, with a thoughtful design. - -### Supported language versions -- Ruby 2.3 or newer -- Rack 1.2 or newer - -# Installation -Install the Logtail Rack client library, run the following command: - -```bash -bundle add logtail-rack -``` +Experience SQL-compatible structured log management based on ClickHouse. [Learn more ⇗](https://betterstack.com/logs) -Alternatively, add `gem "logtail-rack"` to your `Gemfile` manually and then run `bundle install`. +## Documentation -Then add following configuration into your `config.ru`: +[Getting started ⇗](https://betterstack.com/docs/logs/ruby-and-rails/#logging-from-rack) -```ruby -# Initialization of logging middlewares (you don't have to use all) -use Logtail::Integrations::Rack::HTTPContext -use Logtail::Integrations::Rack::HTTPEvents -use Logtail::Integrations::Rack::ErrorEvent -use Logtail::Integrations::Rack::UserContext -use Logtail::Integrations::Rack::SessionContext - -http_io_device = Logtail::LogDevices::HTTP.new("") -logger = Logtail::Logger.new(http_io_device) -Logtail::Config.instance.logger = logger - -# Here is your application initialization -run ... -``` - -*Don't forget to replace `` with your actual source token which you can find by going to [Better Stack Logs](https://logs.betterstack.com/dashboard) -> Source -> Edit.* +## Need help? +Please let us know at [hello@betterstack.com](mailto:hello@betterstack.com). We're happy to help! --- -# Example project - -To help you get started with using Better Stack in your Rails 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](https://github.com/logtail/logtail-ruby-rack/tree/main/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: - -```bash -bundle install -``` - -This will install all dependencies listed in the `Gemfile.lock` file. - -Then replace `` in `config.ru` with your actual source token which you can find by going to [Better Stack Logs](https://logs.betterstack.com/dashboard) -> Source -> Edit. - -```ruby -http_io_device = Logtail::LogDevices::HTTP.new("") -``` - -## Run the example project - -To run the example application, run the following command: - -```bash -rackup -``` - -This will start a local server and you visit [http://127.0.0.1:9292](http://127.0.0.1:9292) in your browser. - -You should see the following output: - -```bash -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](http://127.0.0.1:9292) to see an example exception being logged. - -## Explore how example project works - -Learn how to setup Ruby logging by exploring the workings of the [example project](https://github.com/logtail/logtail-ruby-rack/tree/main/example-project) in detail. - ---- - -## Get in touch - -Have any questions? Please explore the Better Stack [documentation](https://betterstack.com/docs/logs/) or contact our [support](https://betterstack.com/help). +[ISC license](https://github.com/logtail/logtail-ruby-rack/blob/main/LICENSE.md), [example project](https://github.com/logtail/logtail-ruby-rack/tree/main/example-project) diff --git a/example-project/README.md b/example-project/README.md new file mode 100644 index 0000000..a17d7cd --- /dev/null +++ b/example-project/README.md @@ -0,0 +1,40 @@ +# 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](https://github.com/logtail/logtail-ruby-rack/tree/main/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: + +```bash +bundle install +``` + +This will install all dependencies listed in the `Gemfile.lock` file. + +Then replace `` in `config.ru` with your actual source token which you can find by going to [Better Stack Logs](https://logs.betterstack.com/dashboard) -> Source -> Edit. + +```ruby +http_io_device = Logtail::LogDevices::HTTP.new("") +``` + +## Run the example project + +To run the example application, run the following command: + +```bash +rackup +``` + +This will start a local server and you visit [http://127.0.0.1:9292](http://127.0.0.1:9292) in your browser. + +You should see the following output: + +```bash +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](http://127.0.0.1:9292) to see an example exception being logged.