logtail-rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logtail-rails/railtie.rb +6 -0
- data/lib/logtail-rails/tasks/logtail.rake +42 -0
- data/lib/logtail-rails/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cdf6c93289e9a34950f3ccdccc1fbe5baad830c2390493e618f8e9d2a7d1895
|
4
|
+
data.tar.gz: a6889e39351d24bc481148844bd03299c5b1d810363fdbd33b37220963bcf54d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26b593b3eb0079cd6520e6933f3e9234c30a519abc235cb23a7d4b680440658a7a79440e2a923c23b49eb789aea491335fe4353dafc6963867c6b6f1c1fdbad6
|
7
|
+
data.tar.gz: d82c1de68a2f0d0afcd327dec621f40298ea72b954588fff38a73a61fe2823981d979a26452e83e28bb6a6b3959be1e964ee5e5e072e6dd873014b307f1e6ab7
|
@@ -5,6 +5,12 @@ module Logtail
|
|
5
5
|
module Rails
|
6
6
|
# Installs Logtail into your Rails app automatically.
|
7
7
|
class Railtie < ::Rails::Railtie
|
8
|
+
railtie_name 'logtail-rails'
|
9
|
+
rake_tasks do
|
10
|
+
path = File.expand_path(__dir__)
|
11
|
+
load "#{path}/tasks/logtail.rake"
|
12
|
+
end
|
13
|
+
|
8
14
|
config.logtail = Config.instance
|
9
15
|
|
10
16
|
config.before_initialize do
|
@@ -0,0 +1,42 @@
|
|
1
|
+
namespace :logtail do
|
2
|
+
desc 'Install a default config/initializers/logtail.rb file'
|
3
|
+
|
4
|
+
def content
|
5
|
+
<<~RUBY
|
6
|
+
if ENV['LOGTAIL_SKIP_LOGS'].blank? && !Rails.env.test?
|
7
|
+
http_device = Logtail::LogDevices::HTTP.new('<ACCESS_TOKEN>')
|
8
|
+
Rails.logger = Logtail::Logger.new(http_device)
|
9
|
+
else
|
10
|
+
Rails.logger = Logtail::Logger.new(STDOUT)
|
11
|
+
end
|
12
|
+
RUBY
|
13
|
+
end
|
14
|
+
|
15
|
+
task install: :environment do
|
16
|
+
quiet = ENV['quiet']
|
17
|
+
force = ENV['force']
|
18
|
+
|
19
|
+
config_file = 'config/initializers/logtail.rb'
|
20
|
+
|
21
|
+
if File.exist?(config_file) && !force
|
22
|
+
puts "logtail.rb file already exists. Use `rake logtail:install force=true` to overwrite."
|
23
|
+
return
|
24
|
+
end
|
25
|
+
|
26
|
+
File.open(config_file, 'w') { |out| out.puts(content) }
|
27
|
+
|
28
|
+
puts <<~EOF unless quiet
|
29
|
+
Installed a default configuration file at #{config_file}.
|
30
|
+
EOF
|
31
|
+
|
32
|
+
puts <<~EOF unless quiet
|
33
|
+
To monitor your logs in production mode, sign up for an account
|
34
|
+
at logtail.com, and replace the access key in the logtail.rb file
|
35
|
+
with the one you receive upon registration.
|
36
|
+
EOF
|
37
|
+
|
38
|
+
puts <<~EOF unless quiet
|
39
|
+
Visit logtail.com/help if you are experiencing installation issues.
|
40
|
+
EOF
|
41
|
+
end
|
42
|
+
end
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logtail
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- lib/logtail-rails/rack_logger.rb
|
233
233
|
- lib/logtail-rails/railtie.rb
|
234
234
|
- lib/logtail-rails/session_context.rb
|
235
|
+
- lib/logtail-rails/tasks/logtail.rake
|
235
236
|
- lib/logtail-rails/version.rb
|
236
237
|
- logtail-rails.gemspec
|
237
238
|
homepage: https://github.com/logtail/logtail-ruby-rails
|