Skip to content

Commit

Permalink
Update README.md: simplification (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrHeinz authored Oct 24, 2023
1 parent 79ff9df commit 21f750c
Showing 1 changed file with 11 additions and 86 deletions.
97 changes: 11 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,97 +1,22 @@
# Logtail - Ruby on Rails Logging Made Easy

[![Logtail ruby dashboard](https://user-images.githubusercontent.com/19272921/154085622-59997d5a-3f91-4bc9-a815-3b8ead16d28d.jpeg)](https://betterstack.com/logtail)
# [Better Stack](https://betterstack.com/logs) Rails client

📣 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-rails.svg)](https://badge.fury.io/rb/logtail-rails)
[![Build Status](https://github.com/logtail/logtail-ruby-rails/actions/workflows/main.yml/badge.svg)](https://github.com/logtail/logtail-ruby-rails/actions/workflows/main.yml)

Collect logs directly from your Ruby on Rails projects. To start logging Ruby projects explore the [Logtail Ruby library](https://github.com/logtail/logtail-ruby).

[Logtail](https://betterstack.com/logtail) 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.5 or newer
- Rails 5.0 or newer

# Installation
Install the Logtail Ruby on Rails client library, run the following command:

```bash
bundle add logtail-rails
```

Alternatively, add `gem "logtail-rails"` to your `Gemfile` manually and then run `bundle install`.

Then add following configuration line into your `config/application.rb`:

```ruby
module YourProject
class Application < Rails::Application
# ...
# configuration of your project
# ...

config.logger = Logtail::Logger.create_default_logger("<SOURCE_TOKEN>")
end
end
```

*Don't forget to replace `<SOURCE_TOKEN>` with your actual source token which you can find by going to [Better Stack Logs](https://logs.betterstack.com/dashboard) -> Source -> Edit.*

---

# Example project

To help you get started with using Logtail in your Ruby on 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-rails/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 `<SOURCE_TOKEN>` in `config/application.rb` with your actual source token which you can find by going to [Better Stack Logs](https://logs.betterstack.com/dashboard) -> Source -> Edit.

```ruby
config.logger = Logtail::Logger.create_default_logger("<YOUR_ACTUAL_SOURCE_TOKEN>")
```

## Run the example project

To run the example application, run the following command:

```bash
rails server
```

This will open a local server [127.0.0.1:3000.](http://127.0.0.1:3000/) On the main page, click the "Let's go!" button to generate test logs.
Experience SQL-compatible structured log management based on ClickHouse. [Learn more ⇗](https://betterstack.com/logs)

You should see the following output:
## Documentation

```bash
All done!
Log into your Logtail account to check your logs.
```
[Getting started ⇗](https://betterstack.com/docs/logs/ruby-and-rails/#logging-from-rails)

This will create a total of 6 different logs, each corresponding to a different log level and one with additional structured data. You can review these logs in Logtail.
## Need help?
Please let us know at [hello@betterstack.com](mailto:hello@betterstack.com). We're happy to help!

## 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-rails/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-rails/blob/main/LICENSE.md), [example project](https://github.com/logtail/logtail-ruby-rails/tree/main/example-project)

0 comments on commit 21f750c

Please sign in to comment.