logtail-rails 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +91 -4
- data/example-project/.gitattributes +7 -0
- data/example-project/.gitignore +35 -0
- data/example-project/Gemfile +74 -0
- data/example-project/README.md +211 -0
- data/example-project/Rakefile +6 -0
- data/example-project/app/assets/config/manifest.js +4 -0
- data/example-project/app/assets/images/.keep +0 -0
- data/example-project/app/assets/stylesheets/application.css +15 -0
- data/example-project/app/channels/application_cable/channel.rb +4 -0
- data/example-project/app/channels/application_cable/connection.rb +4 -0
- data/example-project/app/controllers/application_controller.rb +2 -0
- data/example-project/app/controllers/concerns/.keep +0 -0
- data/example-project/app/controllers/example_controller.rb +40 -0
- data/example-project/app/helpers/application_helper.rb +2 -0
- data/example-project/app/helpers/example_helper.rb +2 -0
- data/example-project/app/javascript/application.js +3 -0
- data/example-project/app/javascript/controllers/application.js +9 -0
- data/example-project/app/javascript/controllers/hello_controller.js +7 -0
- data/example-project/app/javascript/controllers/index.js +11 -0
- data/example-project/app/jobs/application_job.rb +7 -0
- data/example-project/app/mailers/application_mailer.rb +4 -0
- data/example-project/app/models/application_record.rb +3 -0
- data/example-project/app/models/concerns/.keep +0 -0
- data/example-project/app/views/example/index.html.erb +3 -0
- data/example-project/app/views/example/send_logs.html.erb +4 -0
- data/example-project/app/views/layouts/application.html.erb +15 -0
- data/example-project/app/views/layouts/mailer.html.erb +13 -0
- data/example-project/app/views/layouts/mailer.text.erb +1 -0
- data/example-project/bin/bundle +114 -0
- data/example-project/bin/importmap +4 -0
- data/example-project/bin/rails +4 -0
- data/example-project/bin/rake +4 -0
- data/example-project/bin/setup +33 -0
- data/example-project/config/application.rb +24 -0
- data/example-project/config/boot.rb +4 -0
- data/example-project/config/cable.yml +11 -0
- data/example-project/config/credentials.yml.enc +1 -0
- data/example-project/config/database.yml +25 -0
- data/example-project/config/environment.rb +5 -0
- data/example-project/config/environments/development.rb +70 -0
- data/example-project/config/environments/production.rb +93 -0
- data/example-project/config/environments/test.rb +60 -0
- data/example-project/config/importmap.rb +7 -0
- data/example-project/config/initializers/assets.rb +12 -0
- data/example-project/config/initializers/content_security_policy.rb +25 -0
- data/example-project/config/initializers/filter_parameter_logging.rb +8 -0
- data/example-project/config/initializers/inflections.rb +16 -0
- data/example-project/config/initializers/permissions_policy.rb +11 -0
- data/example-project/config/locales/en.yml +33 -0
- data/example-project/config/puma.rb +43 -0
- data/example-project/config/routes.rb +7 -0
- data/example-project/config/storage.yml +34 -0
- data/example-project/config.ru +6 -0
- data/example-project/db/seeds.rb +7 -0
- data/example-project/lib/assets/.keep +0 -0
- data/example-project/lib/tasks/.keep +0 -0
- data/example-project/log/.keep +0 -0
- data/example-project/public/404.html +67 -0
- data/example-project/public/422.html +67 -0
- data/example-project/public/500.html +66 -0
- data/example-project/public/apple-touch-icon-precomposed.png +0 -0
- data/example-project/public/apple-touch-icon.png +0 -0
- data/example-project/public/favicon.ico +0 -0
- data/example-project/public/robots.txt +1 -0
- data/example-project/storage/.keep +0 -0
- data/example-project/test/application_system_test_case.rb +5 -0
- data/example-project/test/channels/application_cable/connection_test.rb +11 -0
- data/example-project/test/controllers/.keep +0 -0
- data/example-project/test/fixtures/files/.keep +0 -0
- data/example-project/test/helpers/.keep +0 -0
- data/example-project/test/integration/.keep +0 -0
- data/example-project/test/mailers/.keep +0 -0
- data/example-project/test/models/.keep +0 -0
- data/example-project/test/system/.keep +0 -0
- data/example-project/test/test_helper.rb +13 -0
- data/example-project/tmp/.keep +0 -0
- data/example-project/tmp/pids/.keep +0 -0
- data/example-project/tmp/storage/.keep +0 -0
- data/example-project/vendor/.keep +0 -0
- data/example-project/vendor/javascript/.keep +0 -0
- data/lib/logtail-rails/log_entry.rb +14 -0
- data/lib/logtail-rails/logger.rb +19 -1
- data/lib/logtail-rails/overrides/active_support_tagged_logging.rb +1 -1
- data/lib/logtail-rails/version.rb +1 -1
- data/lib/logtail-rails.rb +6 -2
- data/logtail-rails.gemspec +6 -3
- metadata +115 -7
- data/lib/logtail-rails/tasks/logtail.rake +0 -57
@@ -1,57 +0,0 @@
|
|
1
|
-
namespace :logtail do
|
2
|
-
desc 'Install a default config/initializers/logtail.rb file'
|
3
|
-
|
4
|
-
PLACEHOLDER = '<SOURCE_TOKEN>'.freeze
|
5
|
-
def content(source_token = nil)
|
6
|
-
<<~RUBY
|
7
|
-
if ENV['LOGTAIL_SKIP_LOGS'].blank? && !Rails.env.test?
|
8
|
-
http_device = Logtail::LogDevices::HTTP.new('#{source_token || PLACEHOLDER}')
|
9
|
-
Rails.logger = Logtail::Logger.new(http_device)
|
10
|
-
else
|
11
|
-
Rails.logger = Logtail::Logger.new(STDOUT)
|
12
|
-
end
|
13
|
-
RUBY
|
14
|
-
end
|
15
|
-
|
16
|
-
task install: :environment do
|
17
|
-
quiet = ENV['quiet']
|
18
|
-
force = ENV['force']
|
19
|
-
source_token = ENV['source_token']
|
20
|
-
|
21
|
-
config_file = 'config/initializers/logtail.rb'
|
22
|
-
|
23
|
-
if File.exist?(config_file) && !force
|
24
|
-
puts "logtail.rb file already exists. Use `rake logtail:install force=true` to overwrite."
|
25
|
-
next
|
26
|
-
end
|
27
|
-
|
28
|
-
File.open(config_file, 'w') { |out| out.puts(content(source_token)) }
|
29
|
-
|
30
|
-
return if quiet
|
31
|
-
|
32
|
-
if source_token.nil? || source_token == ''
|
33
|
-
puts <<~EOF
|
34
|
-
Installed a default configuration file at #{config_file}.
|
35
|
-
EOF
|
36
|
-
|
37
|
-
puts <<~EOF
|
38
|
-
To monitor your logs in production mode, sign up for an account
|
39
|
-
at logtail.com, and replace the source token in the logtail.rb file
|
40
|
-
with the one you receive upon registration.
|
41
|
-
EOF
|
42
|
-
|
43
|
-
puts <<~EOF
|
44
|
-
Visit logtail.com/help if you are experiencing installation issues.
|
45
|
-
EOF
|
46
|
-
else
|
47
|
-
puts <<~EOF
|
48
|
-
Installed a configuration file at #{config_file} with a source token
|
49
|
-
ending with '#{source_token[-4..-1]}'.
|
50
|
-
EOF
|
51
|
-
|
52
|
-
puts <<~EOF
|
53
|
-
Visit logtail.com/help if you are experiencing installation issues.
|
54
|
-
EOF
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|