Skip to content

Commit

Permalink
Create example-project/README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrHeinz authored Oct 24, 2023
1 parent eb93327 commit 581a0c5
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions example-project/README.md
Original file line number Diff line number Diff line change
@@ -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 `<SOURCE_TOKEN>` 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("<YOUR_ACTUAL_SOURCE_TOKEN>")
```

## 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.

0 comments on commit 581a0c5

Please sign in to comment.