lib/timber/cli/install.rb in timber-2.0.2 vs lib/timber/cli/install.rb in timber-2.0.3

- old
+ new

@@ -38,10 +38,13 @@ puts Messages.separator puts "" puts Messages.heroku_install(app) puts "" + ask_yes_no("Ready to proceed?") + puts "" + else puts "" puts Messages.separator puts "" puts "How would you like configure Timber?" @@ -56,39 +59,44 @@ puts "" puts Messages.http_environment_variables(app.api_key) puts "" + ask_yes_no("Ready to proceed?") + puts "" + when "2" create_initializer(:http, :api_key_code => "'#{app.api_key}'") - puts "" end send_test_messages(api_key) end + api.wait_for_logs do |iteration| write Messages.task_start("Waiting for logs") write Messages.spinner(iteration) end puts colorize(Messages.task_complete("Waiting for logs"), :green) puts "" puts Messages.separator puts "" - puts Messages.free_data - puts "" - puts Messages.separator - puts "" puts Messages.commit_and_deploy_reminder api.event!(:success) collect_feedback(api) + puts "" + puts Messages.separator + puts "" + puts Messages.free_data + puts "" + when :no puts "" puts "Bummer. Head to this URL to update the details:" puts "" puts " #{Messages.edit_app_url(app)}" @@ -106,11 +114,11 @@ logger_code = \ case log_device_type when :http api_key_code = options[:api_key_code] || raise(ArgumentError.new("the :api_key_code option is required")) "log_device = Timber::LogDevices::HTTP.new(#{api_key_code})\n" + - "Timber::Logger.new(log_device)" + " Timber::Logger.new(log_device)" when :stdout "Timber::Logger.new(STDOUT)" end @@ -125,19 +133,23 @@ # Library: http://github.com/timberio/timber-ruby # Docs: http://www.rubydoc.info/github/timberio/timber-ruby # Support: support@timber.io logger = case Rails.env -when "development", "test" - logger = Timber::Logger.new(STDOUT) - logger.formatter = Timber::Logger::SimpleFormatter.new - logger -else +when "development" + # Write logs to STDOUT in a simple message only format + Timber::Logger.new(STDOUT).tap do |logger| + logger.formatter = Timber::Logger::SimpleFormatter.new + end +when "production", "staging" #{logger_code} end -Timber::Frameworks::Rails.set_logger(logger) +if logger + logger.level = Rails.application.config.log_level + Timber::Frameworks::Rails.set_logger(logger) +end BODY FileUtils.mkdir_p(File.join(Dir.pwd, "config", "initializers")) File.write(File.join(Dir.pwd, "config/initializers/timber.rb"), body) @@ -175,11 +187,9 @@ api.event!(:feedback, rating: rating.to_i, comments: comments) puts "" puts "Thank you! We take feedback seriously and will work to improve this." end - - puts "" end end end end end \ No newline at end of file