Class: Rsg::Generators::Logging::LogrageGenerator
- Inherits:
-
Base
- Object
- Base
- Rsg::Generators::Logging::LogrageGenerator
- Defined in:
- lib/rsg/generators/logging/lograge_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_lograge ⇒ Object
6 7 8 9 |
# File 'lib/rsg/generators/logging/lograge_generator.rb', line 6 def add_lograge append_gem "lograge", install: false append_gem "logstash-event", after: "lograge" end |
#banner ⇒ Object
2 3 4 |
# File 'lib/rsg/generators/logging/lograge_generator.rb', line 2 def say "Configuring lograge with JSON logging" end |
#initializer ⇒ Object
11 12 13 |
# File 'lib/rsg/generators/logging/lograge_generator.rb', line 11 def initializer copy_file "initializer_lograge.rb", "config/initializers/logging.rb" end |
#json_logs_env_var ⇒ Object
15 16 17 18 19 20 |
# File 'lib/rsg/generators/logging/lograge_generator.rb', line 15 def json_logs_env_var inject_into_file "config/application.rb", <<-CODE, before: /^ end$/ \n # Enable JSON logs with lograge config.x.json_logs = Rails.env.production? || %w[1 true yes].include?(ENV.fetch('JSON_LOGS', '0')) CODE end |