logtail-rails 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -8
  3. data/example-project/.gitattributes +7 -0
  4. data/example-project/.gitignore +35 -0
  5. data/example-project/Gemfile +74 -0
  6. data/example-project/README.md +12 -6
  7. data/example-project/app/assets/config/manifest.js +4 -0
  8. data/example-project/app/assets/images/.keep +0 -0
  9. data/example-project/app/controllers/concerns/.keep +0 -0
  10. data/example-project/{Logtail-rails-main/app → app}/controllers/example_controller.rb +6 -1
  11. data/example-project/app/javascript/application.js +3 -0
  12. data/example-project/app/javascript/controllers/application.js +9 -0
  13. data/example-project/app/javascript/controllers/hello_controller.js +7 -0
  14. data/example-project/app/javascript/controllers/index.js +11 -0
  15. data/example-project/app/models/concerns/.keep +0 -0
  16. data/example-project/bin/bundle +114 -0
  17. data/example-project/bin/importmap +4 -0
  18. data/example-project/{Logtail-rails-main/bin → bin}/rails +0 -0
  19. data/example-project/{Logtail-rails-main/bin → bin}/rake +0 -0
  20. data/example-project/{Logtail-rails-main/bin → bin}/setup +0 -0
  21. data/example-project/{Logtail-rails-main/config → config}/application.rb +3 -1
  22. data/example-project/{Logtail-rails-main/config → config}/cable.yml +3 -2
  23. data/example-project/config/credentials.yml.enc +1 -0
  24. data/example-project/{Logtail-rails-main/config → config}/environments/production.rb +1 -1
  25. data/example-project/config/importmap.rb +7 -0
  26. data/example-project/{Logtail-rails-main/config → config}/initializers/content_security_policy.rb +4 -5
  27. data/example-project/db/seeds.rb +7 -0
  28. data/example-project/lib/assets/.keep +0 -0
  29. data/example-project/lib/tasks/.keep +0 -0
  30. data/example-project/log/.keep +0 -0
  31. data/example-project/public/404.html +67 -0
  32. data/example-project/public/422.html +67 -0
  33. data/example-project/public/500.html +66 -0
  34. data/example-project/public/apple-touch-icon-precomposed.png +0 -0
  35. data/example-project/public/apple-touch-icon.png +0 -0
  36. data/example-project/public/favicon.ico +0 -0
  37. data/example-project/public/robots.txt +1 -0
  38. data/example-project/storage/.keep +0 -0
  39. data/example-project/test/controllers/.keep +0 -0
  40. data/example-project/test/fixtures/files/.keep +0 -0
  41. data/example-project/test/helpers/.keep +0 -0
  42. data/example-project/test/integration/.keep +0 -0
  43. data/example-project/test/mailers/.keep +0 -0
  44. data/example-project/test/models/.keep +0 -0
  45. data/example-project/test/system/.keep +0 -0
  46. data/example-project/tmp/.keep +0 -0
  47. data/example-project/tmp/pids/.keep +0 -0
  48. data/example-project/tmp/storage/.keep +0 -0
  49. data/example-project/vendor/.keep +0 -0
  50. data/example-project/vendor/javascript/.keep +0 -0
  51. data/lib/logtail-rails/log_entry.rb +14 -0
  52. data/lib/logtail-rails/logger.rb +19 -1
  53. data/lib/logtail-rails/overrides/active_support_tagged_logging.rb +1 -1
  54. data/lib/logtail-rails/version.rb +1 -1
  55. data/lib/logtail-rails.rb +1 -1
  56. data/logtail-rails.gemspec +2 -2
  57. metadata +85 -50
  58. data/example-project/Logtail-rails-main/app/assets/config/manifest.js +0 -2
  59. data/example-project/Logtail-rails-main/config/credentials.yml.enc +0 -1
  60. data/example-project/Logtail-rails-main/config/initializers/logtail.rb +0 -6
  61. data/example-project/Logtail-rails-main/test/controllers/example_controller_test.rb +0 -7
  62. data/lib/logtail-rails/tasks/logtail.rake +0 -57
  63. /data/example-project/{Logtail-rails-main/Rakefile → Rakefile} +0 -0
  64. /data/example-project/{Logtail-rails-main/app → app}/assets/stylesheets/application.css +0 -0
  65. /data/example-project/{Logtail-rails-main/app → app}/channels/application_cable/channel.rb +0 -0
  66. /data/example-project/{Logtail-rails-main/app → app}/channels/application_cable/connection.rb +0 -0
  67. /data/example-project/{Logtail-rails-main/app → app}/controllers/application_controller.rb +0 -0
  68. /data/example-project/{Logtail-rails-main/app → app}/helpers/application_helper.rb +0 -0
  69. /data/example-project/{Logtail-rails-main/app → app}/helpers/example_helper.rb +0 -0
  70. /data/example-project/{Logtail-rails-main/app → app}/jobs/application_job.rb +0 -0
  71. /data/example-project/{Logtail-rails-main/app → app}/mailers/application_mailer.rb +0 -0
  72. /data/example-project/{Logtail-rails-main/app → app}/models/application_record.rb +0 -0
  73. /data/example-project/{Logtail-rails-main/app → app}/views/example/index.html.erb +0 -0
  74. /data/example-project/{Logtail-rails-main/app → app}/views/example/send_logs.html.erb +0 -0
  75. /data/example-project/{Logtail-rails-main/app → app}/views/layouts/application.html.erb +0 -0
  76. /data/example-project/{Logtail-rails-main/app → app}/views/layouts/mailer.html.erb +0 -0
  77. /data/example-project/{Logtail-rails-main/app → app}/views/layouts/mailer.text.erb +0 -0
  78. /data/example-project/{Logtail-rails-main/config → config}/boot.rb +0 -0
  79. /data/example-project/{Logtail-rails-main/config → config}/database.yml +0 -0
  80. /data/example-project/{Logtail-rails-main/config → config}/environment.rb +0 -0
  81. /data/example-project/{Logtail-rails-main/config → config}/environments/development.rb +0 -0
  82. /data/example-project/{Logtail-rails-main/config → config}/environments/test.rb +0 -0
  83. /data/example-project/{Logtail-rails-main/config → config}/initializers/assets.rb +0 -0
  84. /data/example-project/{Logtail-rails-main/config → config}/initializers/filter_parameter_logging.rb +0 -0
  85. /data/example-project/{Logtail-rails-main/config → config}/initializers/inflections.rb +0 -0
  86. /data/example-project/{Logtail-rails-main/config → config}/initializers/permissions_policy.rb +0 -0
  87. /data/example-project/{Logtail-rails-main/config → config}/locales/en.yml +0 -0
  88. /data/example-project/{Logtail-rails-main/config → config}/puma.rb +0 -0
  89. /data/example-project/{Logtail-rails-main/config → config}/routes.rb +0 -0
  90. /data/example-project/{Logtail-rails-main/config → config}/storage.yml +0 -0
  91. /data/example-project/{Logtail-rails-main/config.ru → config.ru} +0 -0
  92. /data/example-project/{Logtail-rails-main/test → test}/application_system_test_case.rb +0 -0
  93. /data/example-project/{Logtail-rails-main/test → test}/channels/application_cable/connection_test.rb +0 -0
  94. /data/example-project/{Logtail-rails-main/test → test}/test_helper.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ea78494f4dc7a43dd8898e76f16af5a6f97ed276a15cb8249337a4f3cf695f1
4
- data.tar.gz: f65e846b9a01b66fd91712109d01d52462a528e847b0b1f3d2f11b26bb9b3142
3
+ metadata.gz: 7eb050c970571683d40dcd025672d9fb0eebcc72261627e7716115b7e16bd3a4
4
+ data.tar.gz: abc54338cfdb59ddc885fc5c3589119b21e9ce6a7bb6d7f8b73301f6f94f2233
5
5
  SHA512:
6
- metadata.gz: 433ab451bc4287d63668e667c6a71b2c114653cf71153e2cab23b0f1515d38d1290c8637787318493e475207a12e99de886dcc5c6222bdf5e41379e682e08bc2
7
- data.tar.gz: 2f1b9607a6d7e972a81d4d62754c395b8bfc0bdb302f06cfb6b8a60c909886c3661f0999015fa902d7a4dbfbf3c989c7809b8c4a5f0a93901e44fc7b4ba50783
6
+ metadata.gz: 493ff5967c0a198b4667bd693074267f4ebe6e543363496a93825e41dd03736ced0e85357c207e1c3ce225375527c9feef424e51f0bd040b977403326e410c6a
7
+ data.tar.gz: d5886072cbfbd130164e68bc7d23c3aaf1e335ee2b8dbb5e115c380c57ae437e6d45ba8797c824847014e3372b4c01600692ede1701c0c283721022c01e18640
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  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).
10
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://docs.logtail.com/).
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
12
 
13
13
  ### Features
14
14
  - Simple integration.
@@ -17,7 +17,8 @@ Collect logs directly from your Ruby on Rails projects. To start logging Ruby pr
17
17
  - Performant, light weight, with a thoughtful design.
18
18
 
19
19
  ### Supported language versions
20
- - Ruby 2.7.0 or newer Rails 6.1.4.2 or newer
20
+ - Ruby 2.7.0 or newer
21
+ - Rails 6.1.4.2 or newer
21
22
 
22
23
  # Installation
23
24
  Install the Logtail Ruby on Rails client library, run the following command:
@@ -28,6 +29,22 @@ bundle add logtail-rails
28
29
 
29
30
  Alternatively, add `gem "logtail-rails"` to your `Gemfile` manually and then run `bundle install`.
30
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
+
31
48
  ---
32
49
 
33
50
  # Example project
@@ -44,14 +61,12 @@ bundle install
44
61
 
45
62
  This will install all dependencies listed in the `Gemfile.lock` file.
46
63
 
47
- Then run the following command to create the default config file:
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.
48
65
 
49
- ```bash
50
- bundle exec rake logtail:install source_token=SOURCE_TOKEN
66
+ ```ruby
67
+ config.logger = Logtail::Logger.create_default_logger("<YOUR_ACTUAL_SOURCE_TOKEN>")
51
68
  ```
52
69
 
53
- *Don't forget to replace `SOURCE_TOKEN` with your actual source token which you can find by going to logtail.com -> sources -> edit. This will generate config/initializers/logtail.rb.*
54
-
55
70
  ## Run the example project
56
71
 
57
72
  To run the example application, run the following command:
@@ -79,4 +94,4 @@ Learn how to setup Ruby logging by exploring the workings of the [example projec
79
94
 
80
95
  ## Get in touch
81
96
 
82
- Have any questions? Please explore the Logtail [documentation](https://docs.logtail.com/) or contact our [support](https://betterstack.com/help).
97
+ Have any questions? Please explore the Better Stack [documentation](https://betterstack.com/docs/logs/) or contact our [support](https://betterstack.com/help).
@@ -0,0 +1,7 @@
1
+ # See https://git-scm.com/docs/gitattributes for more about git attribute files.
2
+
3
+ # Mark the database schema as having been generated.
4
+ db/schema.rb linguist-generated
5
+
6
+ # Mark any vendored files as having been vendored.
7
+ vendor/* linguist-vendored
@@ -0,0 +1,35 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-*
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ /tmp/*
17
+ !/log/.keep
18
+ !/tmp/.keep
19
+
20
+ # Ignore pidfiles, but keep the directory.
21
+ /tmp/pids/*
22
+ !/tmp/pids/
23
+ !/tmp/pids/.keep
24
+
25
+ # Ignore uploaded files in development.
26
+ /storage/*
27
+ !/storage/.keep
28
+ /tmp/storage/*
29
+ !/tmp/storage/
30
+ !/tmp/storage/.keep
31
+
32
+ /public/assets
33
+
34
+ # Ignore master key for decrypting credentials and more.
35
+ /config/master.key
@@ -0,0 +1,74 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby "3.1.2"
5
+
6
+ # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
7
+ gem "rails", "~> 7.0.6"
8
+
9
+ # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
10
+ gem "sprockets-rails"
11
+
12
+ # Use sqlite3 as the database for Active Record
13
+ gem "sqlite3", "~> 1.4"
14
+
15
+ # Use the Puma web server [https://github.com/puma/puma]
16
+ gem "puma", "~> 5.0"
17
+
18
+ # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
19
+ gem "importmap-rails"
20
+
21
+ # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
22
+ gem "turbo-rails"
23
+
24
+ # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
25
+ gem "stimulus-rails"
26
+
27
+ # Build JSON APIs with ease [https://github.com/rails/jbuilder]
28
+ gem "jbuilder"
29
+
30
+ # Use Redis adapter to run Action Cable in production
31
+ gem "redis", "~> 4.0"
32
+
33
+ # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
34
+ # gem "kredis"
35
+
36
+ # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
37
+ # gem "bcrypt", "~> 3.1.7"
38
+
39
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
40
+ gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
41
+
42
+ # Reduces boot times through caching; required in config/boot.rb
43
+ gem "bootsnap", require: false
44
+
45
+ # Use Sass to process CSS
46
+ # gem "sassc-rails"
47
+
48
+ # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
49
+ # gem "image_processing", "~> 1.2"
50
+
51
+ group :development, :test do
52
+ # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
53
+ gem "debug", platforms: %i[ mri mingw x64_mingw ]
54
+ end
55
+
56
+ group :development do
57
+ # Use console on exceptions pages [https://github.com/rails/web-console]
58
+ gem "web-console"
59
+
60
+ # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
61
+ # gem "rack-mini-profiler"
62
+
63
+ # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
64
+ # gem "spring"
65
+ end
66
+
67
+ group :test do
68
+ # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
69
+ gem "capybara"
70
+ gem "selenium-webdriver"
71
+ gem "webdrivers"
72
+ end
73
+
74
+ gem "logtail-rails", "~> 0.1.7"
@@ -11,9 +11,15 @@ bundle install
11
11
 
12
12
  This will install all dependencies listed in the `Gemfile.lock` file.
13
13
 
14
- ## Run the example project
14
+ Then replace `<SOURCE_TOKEN>` in `config/application.rb` with your actual source token which you can find by going to [Better Stack](https://logs.betterstack.com/) -> Sources -> Edit.
15
+
16
+ ```ruby
17
+ config.logger = Logtail::Logger.create_default_logger("<YOUR_ACTUAL_SOURCE_TOKEN>")
18
+ ```
19
+
20
+ ## Run the example project
15
21
 
16
- To run the example application, run the following command:
22
+ To run the example application, run the following command:
17
23
 
18
24
  ```bash
19
25
  rails server
@@ -68,7 +74,7 @@ This will create the following output:
68
74
  "frame_label": "<main>"
69
75
  },
70
76
  "system": {
71
- "hostname": "hostname"
77
+ "hostname": "hostname",
72
78
  "pid": 1234
73
79
  }
74
80
  }
@@ -87,7 +93,7 @@ This will create the following output:
87
93
  "frame_label": "<main>"
88
94
  },
89
95
  "system": {
90
- "hostname": "hostname"
96
+ "hostname": "hostname",
91
97
  "pid": 1234
92
98
  }
93
99
  }
@@ -130,7 +136,7 @@ This will create the following output:
130
136
  "frame_label": "<main>"
131
137
  },
132
138
  "system": {
133
- "hostname": "hostname"
139
+ "hostname": "hostname",
134
140
  "pid": 1234
135
141
  }
136
142
  }
@@ -166,7 +172,7 @@ This will generate the following JSON output:
166
172
  "frame_label": "<main>"
167
173
  },
168
174
  "system": {
169
- "hostname": "hostname"
175
+ "hostname": "hostname",
170
176
  "pid": 1234
171
177
  },
172
178
  "user": {
@@ -0,0 +1,4 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
3
+ //= link_tree ../../javascript .js
4
+ //= link_tree ../../../vendor/javascript .js
File without changes
File without changes
@@ -21,7 +21,12 @@ class ExampleController < ApplicationController
21
21
  Rails.logger.error("Oops! Something went wrong.")
22
22
 
23
23
  # Send messages about fatal events thet caused the app to crash using the fatal() method
24
- Rails.logger.fatal("Application crashed! Needs to be fixed ASP!")
24
+ Rails.logger.fatal("Application crashed! Needs to be fixed ASAP!")
25
+
26
+
27
+ # You can optionally add tags when logging
28
+ Rails.logger.tagged("tag1", "tag2").info("log message with tags")
29
+
25
30
 
26
31
  # You can also provide additional information when logging
27
32
  Rails.logger.warn("log structured data",
@@ -0,0 +1,3 @@
1
+ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
2
+ import "@hotwired/turbo-rails"
3
+ import "controllers"
@@ -0,0 +1,9 @@
1
+ import { Application } from "@hotwired/stimulus"
2
+
3
+ const application = Application.start()
4
+
5
+ // Configure Stimulus development experience
6
+ application.debug = false
7
+ window.Stimulus = application
8
+
9
+ export { application }
@@ -0,0 +1,7 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ connect() {
5
+ this.element.textContent = "Hello World!"
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ // Import and register all your controllers from the importmap under controllers/*
2
+
3
+ import { application } from "controllers/application"
4
+
5
+ // Eager load all controllers defined in the import map under controllers/**/*_controller
6
+ import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
7
+ eagerLoadControllersFrom("controllers", application)
8
+
9
+ // Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
10
+ // import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
11
+ // lazyLoadControllersFrom("controllers", application)
File without changes
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../Gemfile", __dir__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_requirement
64
+ @bundler_requirement ||=
65
+ env_var_version || cli_arg_version ||
66
+ bundler_requirement_for(lockfile_version)
67
+ end
68
+
69
+ def bundler_requirement_for(version)
70
+ return "#{Gem::Requirement.default}.a" unless version
71
+
72
+ bundler_gem_version = Gem::Version.new(version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
81
+ end
82
+
83
+ def load_bundler!
84
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
85
+
86
+ activate_bundler
87
+ end
88
+
89
+ def activate_bundler
90
+ gem_error = activation_error_handling do
91
+ gem "bundler", bundler_requirement
92
+ end
93
+ return if gem_error.nil?
94
+ require_error = activation_error_handling do
95
+ require "bundler/version"
96
+ end
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
+ exit 42
100
+ end
101
+
102
+ def activation_error_handling
103
+ yield
104
+ nil
105
+ rescue StandardError, LoadError => e
106
+ e
107
+ end
108
+ end
109
+
110
+ m.load_bundler!
111
+
112
+ if m.invoked_as_script?
113
+ load Gem.bin_path("bundler", "bundle")
114
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../config/application"
4
+ require "importmap/commands"
@@ -6,7 +6,7 @@ require "rails/all"
6
6
  # you've limited to :test, :development, or :production.
7
7
  Bundler.require(*Rails.groups)
8
8
 
9
- module LogtailExampleProject
9
+ module ExampleProject
10
10
  class Application < Rails::Application
11
11
  # Initialize configuration defaults for originally generated Rails version.
12
12
  config.load_defaults 7.0
@@ -18,5 +18,7 @@ module LogtailExampleProject
18
18
  #
19
19
  # config.time_zone = "Central Time (US & Canada)"
20
20
  # config.eager_load_paths << Rails.root.join("extras")
21
+
22
+ config.logger = Logtail::Logger.create_default_logger("<SOURCE_TOKEN>")
21
23
  end
22
24
  end
@@ -1,5 +1,6 @@
1
1
  development:
2
- adapter: async
2
+ adapter: redis
3
+ url: redis://localhost:6379/1
3
4
 
4
5
  test:
5
6
  adapter: test
@@ -7,4 +8,4 @@ test:
7
8
  production:
8
9
  adapter: redis
9
10
  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
- channel_prefix: logtail_example_project_production
11
+ channel_prefix: example_project_production
@@ -0,0 +1 @@
1
+ u5F6mYmJTWGf/CBg3jnVmomeM9HcBnaX5PXXM81P16kv/gX0vjihe63RRPJl+ku43YmY56FT3KYhGzM/UvKC7ghVoVptw8J3fxozeeaurhFk05XUZsP69zzFepDtIBDbAwPB5jE+MnkZlO3Uczbmo4bHiqrHo4qIxefpZiDFb5X1lyAv9lP/OOVl2mulA3DCfUSfWQwLi6uZXkaFxufAhTPR7iX6tlm72GDKzRNGF8mvYWo74gTJwgT045YyrtdG2srXZ17jqS29RJze3xWhzH9cROky3HVJg5xPpa+P6KUPOCGStlL1IvdCrwGYtSUvdNOYbARw34o4TvzJ7XEpg9Iiv6AZEzLYm+Cu+YUYaN/h+wI24pt6Mj8SxyktZyyjpocLAWxyArqG/tracaMOKzAisGkrPpQEEb/y--C/Fu8NWIDFMQCJ/O--KrABv9kEtKUALstPjVphjg==
@@ -60,7 +60,7 @@ Rails.application.configure do
60
60
 
61
61
  # Use a real queuing backend for Active Job (and separate queues per environment).
62
62
  # config.active_job.queue_adapter = :resque
63
- # config.active_job.queue_name_prefix = "logtail_example_project_production"
63
+ # config.active_job.queue_name_prefix = "example_project_production"
64
64
 
65
65
  config.action_mailer.perform_caching = false
66
66
 
@@ -0,0 +1,7 @@
1
+ # Pin npm packages by running ./bin/importmap
2
+
3
+ pin "application", preload: true
4
+ pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
5
+ pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
6
+ pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
7
+ pin_all_from "app/javascript/controllers", under: "controllers"
@@ -1,8 +1,8 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Define an application-wide content security policy
4
- # For further information see the following documentation
5
- # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
3
+ # Define an application-wide content security policy.
4
+ # See the Securing Rails Applications Guide for more information:
5
+ # https://guides.rubyonrails.org/security.html#content-security-policy-header
6
6
 
7
7
  # Rails.application.configure do
8
8
  # config.content_security_policy do |policy|
@@ -20,7 +20,6 @@
20
20
  # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21
21
  # config.content_security_policy_nonce_directives = %w(script-src)
22
22
  #
23
- # # Report CSP violations to a specified URI. See:
24
- # # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
23
+ # # Report violations without enforcing the policy.
25
24
  # # config.content_security_policy_report_only = true
26
25
  # end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
7
+ # Character.create(name: "Luke", movie: movies.first)
File without changes
File without changes
File without changes
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>