logtail-rails 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -86
- data/example-project/Gemfile +1 -1
- data/example-project/config/application.rb +1 -1
- data/lib/logtail-rails/logger.rb +3 -2
- data/lib/logtail-rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5832e8cb26c3fa1074500d631b899f379f5404decd1b6d2e1754412b84de1c2d
|
4
|
+
data.tar.gz: 4ac40078b3e30df1e5c95fe6cb44fb2d9ebec95c2663fdc6ab15e38d9fabaaca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd874966a740cb7c21e31c577481c28b611b0c3e25801480a29e2a754f1df20c0b3894dc44ae2e08f64ff98fa088364b4242e50e6fa408878c50824823301a89
|
7
|
+
data.tar.gz: f6ed0342a87e51d35e9a1750b3397b72f32676836a620e8c524001fcf03efe8c8966b2cab008982075ccc17066023eca727e42a71c4e6fe0dff74cc9bf66e02f
|
data/README.md
CHANGED
@@ -1,97 +1,22 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
1
|
+
# [Better Stack](https://betterstack.com/logs) Rails client
|
2
|
+
|
3
|
+
📣 Logtail is now part of Better Stack. [Learn more ⇗](https://betterstack.com/press/introducing-better-stack/)
|
4
|
+
|
5
|
+
[![Better Stack dashboard](https://github.com/logtail/logtail-python/assets/10132717/e2a1196b-7924-4abc-9b85-055e17b5d499)](https://betterstack.com/logs)
|
4
6
|
|
5
7
|
[![ISC License](https://img.shields.io/badge/license-ISC-ff69b4.svg)](LICENSE.md)
|
6
8
|
[![Gem Version](https://badge.fury.io/rb/logtail-rails.svg)](https://badge.fury.io/rb/logtail-rails)
|
7
9
|
[![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)
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
[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/).
|
12
|
-
|
13
|
-
### Features
|
14
|
-
- Simple integration.
|
15
|
-
- Support for structured logging and events.
|
16
|
-
- Automatically captures useful context.
|
17
|
-
- Performant, light weight, with a thoughtful design.
|
18
|
-
|
19
|
-
### Supported language versions
|
20
|
-
- Ruby 2.5 or newer
|
21
|
-
- Rails 5.0 or newer
|
22
|
-
|
23
|
-
# Installation
|
24
|
-
Install the Logtail Ruby on Rails client library, run the following command:
|
25
|
-
|
26
|
-
```bash
|
27
|
-
bundle add logtail-rails
|
28
|
-
```
|
29
|
-
|
30
|
-
Alternatively, add `gem "logtail-rails"` to your `Gemfile` manually and then run `bundle install`.
|
31
|
-
|
32
|
-
Then add following configuration line into your `config/application.rb`:
|
33
|
-
|
34
|
-
```ruby
|
35
|
-
module YourProject
|
36
|
-
class Application < Rails::Application
|
37
|
-
# ...
|
38
|
-
# configuration of your project
|
39
|
-
# ...
|
40
|
-
|
41
|
-
config.logger = Logtail::Logger.create_default_logger("<SOURCE_TOKEN>")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
```
|
45
|
-
|
46
|
-
*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.*
|
47
|
-
|
48
|
-
---
|
49
|
-
|
50
|
-
# Example project
|
51
|
-
|
52
|
-
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.
|
53
|
-
|
54
|
-
## Download and install the example project
|
55
|
-
|
56
|
-
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:
|
57
|
-
|
58
|
-
```bash
|
59
|
-
bundle install
|
60
|
-
```
|
61
|
-
|
62
|
-
This will install all dependencies listed in the `Gemfile.lock` file.
|
63
|
-
|
64
|
-
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.
|
65
|
-
|
66
|
-
```ruby
|
67
|
-
config.logger = Logtail::Logger.create_default_logger("<YOUR_ACTUAL_SOURCE_TOKEN>")
|
68
|
-
```
|
69
|
-
|
70
|
-
## Run the example project
|
71
|
-
|
72
|
-
To run the example application, run the following command:
|
73
|
-
|
74
|
-
```bash
|
75
|
-
rails server
|
76
|
-
```
|
77
|
-
|
78
|
-
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.
|
11
|
+
Experience SQL-compatible structured log management based on ClickHouse. [Learn more ⇗](https://betterstack.com/logs)
|
79
12
|
|
80
|
-
|
13
|
+
## Documentation
|
81
14
|
|
82
|
-
|
83
|
-
All done!
|
84
|
-
Log into your Logtail account to check your logs.
|
85
|
-
```
|
15
|
+
[Getting started ⇗](https://betterstack.com/docs/logs/ruby-and-rails/#logging-from-rails)
|
86
16
|
|
87
|
-
|
17
|
+
## Need help?
|
18
|
+
Please let us know at [hello@betterstack.com](mailto:hello@betterstack.com). We're happy to help!
|
88
19
|
|
89
|
-
## Explore how example project works
|
90
|
-
|
91
|
-
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.
|
92
|
-
|
93
20
|
---
|
94
|
-
|
95
|
-
## Get in touch
|
96
21
|
|
97
|
-
|
22
|
+
[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)
|
data/example-project/Gemfile
CHANGED
@@ -19,6 +19,6 @@ module ExampleProject
|
|
19
19
|
# config.time_zone = "Central Time (US & Canada)"
|
20
20
|
# config.eager_load_paths << Rails.root.join("extras")
|
21
21
|
|
22
|
-
config.logger = Logtail::Logger.create_default_logger("
|
22
|
+
config.logger = Logtail::Logger.create_default_logger("<SOURCE_TOKEN>")
|
23
23
|
end
|
24
24
|
end
|
data/lib/logtail-rails/logger.rb
CHANGED
@@ -17,11 +17,12 @@ module Logtail
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# Logtail::Logger also works as ActiveSupport::BroadcastLogger
|
20
|
-
def
|
21
|
-
return true if clazz == ::ActiveSupport::BroadcastLogger
|
20
|
+
def kind_of?(clazz)
|
21
|
+
return true if defined?(::ActiveSupport::BroadcastLogger) && clazz == ::ActiveSupport::BroadcastLogger
|
22
22
|
|
23
23
|
super(clazz)
|
24
24
|
end
|
25
|
+
alias is_a? kind_of?
|
25
26
|
|
26
27
|
def broadcasts
|
27
28
|
[self] + @extra_loggers
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logtail-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Better Stack
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logtail
|
@@ -361,7 +361,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
361
361
|
- !ruby/object:Gem::Version
|
362
362
|
version: '0'
|
363
363
|
requirements: []
|
364
|
-
rubygems_version: 3.
|
364
|
+
rubygems_version: 3.4.10
|
365
365
|
signing_key:
|
366
366
|
specification_version: 4
|
367
367
|
summary: Better Stack Rails integration
|