timberio 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +34 -0
  3. data/.gitignore +14 -0
  4. data/Appraisals +37 -0
  5. data/Gemfile +22 -0
  6. data/LICENSE +38 -0
  7. data/README.md +22 -0
  8. data/Rakefile +4 -0
  9. data/TODO +4 -0
  10. data/benchmark/README.md +26 -0
  11. data/benchmark/rails_request.rb +68 -0
  12. data/benchmark/support/rails.rb +69 -0
  13. data/circle.yml +27 -0
  14. data/docs/installation/rails_on_heroku.md +31 -0
  15. data/docs/installation/rails_over_http.md +22 -0
  16. data/gemfiles/rails_3.0.X.gemfile +25 -0
  17. data/gemfiles/rails_3.1.X.gemfile +25 -0
  18. data/gemfiles/rails_3.2.X.gemfile +25 -0
  19. data/gemfiles/rails_4.0.X.gemfile +26 -0
  20. data/gemfiles/rails_4.1.X.gemfile +26 -0
  21. data/gemfiles/rails_4.2.X.gemfile +26 -0
  22. data/gemfiles/rails_5.0.X.gemfile +26 -0
  23. data/gemfiles/rails_edge.gemfile +27 -0
  24. data/lib/timber/api_settings.rb +17 -0
  25. data/lib/timber/bootstrap.rb +45 -0
  26. data/lib/timber/config.rb +25 -0
  27. data/lib/timber/context.rb +76 -0
  28. data/lib/timber/context_snapshot.rb +64 -0
  29. data/lib/timber/contexts/dynamic_values.rb +59 -0
  30. data/lib/timber/contexts/exception.rb +40 -0
  31. data/lib/timber/contexts/http_request.rb +22 -0
  32. data/lib/timber/contexts/http_requests/action_controller_specific.rb +48 -0
  33. data/lib/timber/contexts/http_requests/rack/params.rb +26 -0
  34. data/lib/timber/contexts/http_requests/rack.rb +105 -0
  35. data/lib/timber/contexts/http_response.rb +19 -0
  36. data/lib/timber/contexts/http_responses/action_controller.rb +76 -0
  37. data/lib/timber/contexts/logger.rb +33 -0
  38. data/lib/timber/contexts/organization.rb +33 -0
  39. data/lib/timber/contexts/organizations/action_controller.rb +34 -0
  40. data/lib/timber/contexts/server.rb +21 -0
  41. data/lib/timber/contexts/servers/heroku_specific.rb +48 -0
  42. data/lib/timber/contexts/sql_queries/active_record.rb +30 -0
  43. data/lib/timber/contexts/sql_queries/active_record_specific/binds.rb +37 -0
  44. data/lib/timber/contexts/sql_queries/active_record_specific.rb +59 -0
  45. data/lib/timber/contexts/sql_query.rb +18 -0
  46. data/lib/timber/contexts/template_render.rb +17 -0
  47. data/lib/timber/contexts/template_renders/action_view.rb +29 -0
  48. data/lib/timber/contexts/template_renders/action_view_specific.rb +51 -0
  49. data/lib/timber/contexts/user.rb +39 -0
  50. data/lib/timber/contexts/users/action_controller.rb +34 -0
  51. data/lib/timber/contexts.rb +23 -0
  52. data/lib/timber/current_context.rb +58 -0
  53. data/lib/timber/current_line_indexes.rb +35 -0
  54. data/lib/timber/frameworks/rails.rb +24 -0
  55. data/lib/timber/frameworks.rb +21 -0
  56. data/lib/timber/internal_logger.rb +35 -0
  57. data/lib/timber/log_device.rb +40 -0
  58. data/lib/timber/log_devices/heroku_logplex/hybrid_formatter.rb +14 -0
  59. data/lib/timber/log_devices/heroku_logplex.rb +14 -0
  60. data/lib/timber/log_devices/http/log_pile.rb +86 -0
  61. data/lib/timber/log_devices/http/log_truck/delivery.rb +116 -0
  62. data/lib/timber/log_devices/http/log_truck.rb +87 -0
  63. data/lib/timber/log_devices/http.rb +28 -0
  64. data/lib/timber/log_devices/io/formatter.rb +46 -0
  65. data/lib/timber/log_devices/io/hybrid_formatter.rb +41 -0
  66. data/lib/timber/log_devices/io/hybrid_hidden_formatter.rb +36 -0
  67. data/lib/timber/log_devices/io/json_formatter.rb +11 -0
  68. data/lib/timber/log_devices/io/logfmt_formatter.rb +11 -0
  69. data/lib/timber/log_devices/io.rb +41 -0
  70. data/lib/timber/log_devices.rb +4 -0
  71. data/lib/timber/log_line.rb +33 -0
  72. data/lib/timber/logger.rb +20 -0
  73. data/lib/timber/macros/compactor.rb +16 -0
  74. data/lib/timber/macros/date_formatter.rb +9 -0
  75. data/lib/timber/macros/deep_merger.rb +11 -0
  76. data/lib/timber/macros/logfmt_encoder.rb +77 -0
  77. data/lib/timber/macros.rb +4 -0
  78. data/lib/timber/patterns/delegated_singleton.rb +21 -0
  79. data/lib/timber/patterns/to_json.rb +22 -0
  80. data/lib/timber/patterns/to_logfmt.rb +9 -0
  81. data/lib/timber/patterns.rb +3 -0
  82. data/lib/timber/probe.rb +21 -0
  83. data/lib/timber/probes/action_controller_base.rb +31 -0
  84. data/lib/timber/probes/action_dispatch_debug_exceptions.rb +57 -0
  85. data/lib/timber/probes/active_support_log_subscriber/action_controller.rb +15 -0
  86. data/lib/timber/probes/active_support_log_subscriber/action_view.rb +26 -0
  87. data/lib/timber/probes/active_support_log_subscriber/active_record.rb +13 -0
  88. data/lib/timber/probes/active_support_log_subscriber.rb +62 -0
  89. data/lib/timber/probes/heroku.rb +30 -0
  90. data/lib/timber/probes/logger.rb +31 -0
  91. data/lib/timber/probes/rack.rb +36 -0
  92. data/lib/timber/probes/server.rb +18 -0
  93. data/lib/timber/probes.rb +24 -0
  94. data/lib/timber/version.rb +3 -0
  95. data/lib/timber.rb +27 -0
  96. data/spec/spec_helper.rb +27 -0
  97. data/spec/support/action_controller.rb +4 -0
  98. data/spec/support/action_view.rb +4 -0
  99. data/spec/support/active_record.rb +28 -0
  100. data/spec/support/coveralls.rb +2 -0
  101. data/spec/support/rails/templates/_partial.html +1 -0
  102. data/spec/support/rails/templates/template.html +1 -0
  103. data/spec/support/rails.rb +33 -0
  104. data/spec/support/simplecov.rb +9 -0
  105. data/spec/support/socket_hostname.rb +12 -0
  106. data/spec/support/timber.rb +23 -0
  107. data/spec/support/timecop.rb +3 -0
  108. data/spec/support/webmock.rb +2 -0
  109. data/spec/timber/bootstrap_spec.rb +31 -0
  110. data/spec/timber/context_snapshot_spec.rb +10 -0
  111. data/spec/timber/context_spec.rb +4 -0
  112. data/spec/timber/contexts/exception_spec.rb +34 -0
  113. data/spec/timber/contexts/organizations/action_controller_spec.rb +49 -0
  114. data/spec/timber/contexts/users/action_controller_spec.rb +65 -0
  115. data/spec/timber/current_line_indexes_spec.rb +40 -0
  116. data/spec/timber/frameworks/rails_spec.rb +9 -0
  117. data/spec/timber/log_devices/heroku_logplex_spec.rb +45 -0
  118. data/spec/timber/log_devices/http/log_truck/delivery_spec.rb +66 -0
  119. data/spec/timber/log_devices/http/log_truck_spec.rb +65 -0
  120. data/spec/timber/log_devices/io/hybrid_hidden_formatter_spec.rb +28 -0
  121. data/spec/timber/log_line_spec.rb +49 -0
  122. data/spec/timber/macros/compactor_spec.rb +19 -0
  123. data/spec/timber/macros/logfmt_encoder_spec.rb +89 -0
  124. data/spec/timber/patterns/to_json_spec.rb +40 -0
  125. data/spec/timber/probes/action_controller_base_spec.rb +43 -0
  126. data/spec/timber/probes/action_controller_log_subscriber/action_controller_spec.rb +35 -0
  127. data/spec/timber/probes/action_controller_log_subscriber/action_view_spec.rb +44 -0
  128. data/spec/timber/probes/action_controller_log_subscriber/active_record_spec.rb +26 -0
  129. data/spec/timber/probes/action_dispatch_debug_exceptions_spec.rb +45 -0
  130. data/spec/timber/probes/logger_spec.rb +20 -0
  131. data/spec/timber/probes/rack_spec.rb +26 -0
  132. data/timberio.gemspec +20 -0
  133. metadata +210 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: afe17c9b981b2874cc9904a025bc1b644241e9fb
4
+ data.tar.gz: 249022ca368e1e7eb482c204ac4764d720777169
5
+ SHA512:
6
+ metadata.gz: 0491b73371eb2d6f77a986aa7853f1811a1d2b0522c825232edf43c94fbacc2e55f290e7be98df494511853e7067fe7d3a75aa772930af29c204a8bc27ef8786
7
+ data.tar.gz: 150da28499ece3b4c99bc9067f525e3c4ffb08ef61499bd85b154f89726e4359ed7b8abdacd407f4435c29ac5641d675df4791564fa0cbee9c0da7b740efb921
data/.codeclimate.yml ADDED
@@ -0,0 +1,34 @@
1
+ engines:
2
+ duplication:
3
+ enabled: true
4
+ config:
5
+ languages:
6
+ - ruby
7
+ - javascript
8
+ - python
9
+ - php
10
+ exclude_fingerprints:
11
+ - 491dd5b768852a27a80385aa82cf7e58
12
+ - 538d87ce2b9bc468129f55f4f3978e58
13
+ - 3a467030ef89f45f0d86a03cb629fb75
14
+ - 39cf272b046d1677fb4ee2b97afb4998
15
+ - 2ad1dc6314661ff8bcf4fdaba7b13b5e
16
+ rubocop:
17
+ enabled: true
18
+ checks:
19
+ Rubocop/Lint/RescueException:
20
+ enabled: false
21
+ ratings:
22
+ paths:
23
+ - "**.inc"
24
+ - "**.js"
25
+ - "**.jsx"
26
+ - "**.module"
27
+ - "**.php"
28
+ - "**.py"
29
+ - "**.rb"
30
+ exclude_paths:
31
+ - benchmark/
32
+ - docs/
33
+ - gemfiles/
34
+ - spec/
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ .DS_Store
2
+ .rvmrc
3
+ coverage
4
+ Gemfile.lock
5
+ *.swp
6
+
7
+ /.bundle
8
+ /.yardoc
9
+ /doc
10
+ /gemfiles/*.lock
11
+ /gemfiles/vendor
12
+ /log
13
+ /tmp
14
+ /pkg
data/Appraisals ADDED
@@ -0,0 +1,37 @@
1
+ appraise "rails-3.0.X" do
2
+ gem "rails", "~> 3.0.20"
3
+ end
4
+
5
+ appraise "rails-3.1.X" do
6
+ gem "rails", "~> 3.1.12"
7
+ end
8
+
9
+ appraise "rails-3.2.X" do
10
+ gem "rails", "~> 3.2.22"
11
+ end
12
+
13
+ appraise "rails-4.0.X" do
14
+ gem "minitest"
15
+ gem "rails", "~> 4.0.13"
16
+ end
17
+
18
+ appraise "rails-4.1.X" do
19
+ gem "minitest"
20
+ gem "rails", "~> 4.1.15"
21
+ end
22
+
23
+ appraise "rails-4.2.X" do
24
+ gem "minitest"
25
+ gem "rails", "~> 4.2.7"
26
+ end
27
+
28
+ appraise "rails-5.0.X" do
29
+ gem "minitest"
30
+ gem "rails", "~> 5.0.0"
31
+ end
32
+
33
+ appraise "rails-edge" do
34
+ gem 'rack', github: 'rack/rack', branch: 'master'
35
+ gem 'arel', github: 'rails/arel', branch: 'master'
36
+ gem 'rails', github: 'rails/rails', branch: 'master'
37
+ end
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ group :test do
5
+ gem 'appraisal'
6
+ gem 'coveralls', require: false
7
+ gem 'json', '~> 1'
8
+ gem 'pry'
9
+ gem 'rails_stdout_logging'
10
+ gem 'rake'
11
+ gem 'rspec', '~> 3.4'
12
+ gem 'rspec-its'
13
+ gem 'simplecov', require: false
14
+ gem 'sqlite3'
15
+ gem 'terminal-table'
16
+ gem 'timecop'
17
+ gem 'webmock', '~> 2.0.3'
18
+
19
+ # for coveralls
20
+ gem 'rest-client', '~> 1.8' # >= 2.0 requires ruby 2+, we have tests for 1.9
21
+ gem 'tins', '~> 1.6.0' # > 1.6 requires ruby 2+, we have tests for 1.9
22
+ end
data/LICENSE ADDED
@@ -0,0 +1,38 @@
1
+ All other components of this product are
2
+ Copyright (c) 2016 Timber Technologies, Inc. All rights reserved.
3
+
4
+ Certain inventions disclosed in this file may be claimed within
5
+ patents owned or patent applications filed by Timber, Inc. or third
6
+ parties.
7
+
8
+ Subject to the terms of this notice, Timber grants you a
9
+ nonexclusive, nontransferable license, without the right to
10
+ sublicense, to (a) install and execute one copy of these files on any
11
+ number of workstations owned or controlled by you and (b) distribute
12
+ verbatim copies of these files to third parties. As a condition to the
13
+ foregoing grant, you must provide this notice along with each copy you
14
+ distribute and you must not remove, alter, or obscure this notice. All
15
+ other use, reproduction, modification, distribution, or other
16
+ exploitation of these files is strictly prohibited, except as may be set
17
+ forth in a separate written license agreement between you and Timber.
18
+ The terms of any such license agreement will control over this
19
+ notice. The license stated above will be automatically terminated and
20
+ revoked if you exceed its scope or violate any of the terms of this
21
+ notice.
22
+
23
+ This License does not grant permission to use the trade names,
24
+ trademarks, service marks, or product names of Timber, except as
25
+ required for reasonable and customary use in describing the origin of
26
+ this file and reproducing the content of this notice. You may not
27
+ mark or brand this file with any trade name, trademarks, service
28
+ marks, or product names other than the original brand (if any)
29
+ provided by Timber.
30
+
31
+ Unless otherwise expressly agreed by Timber in a separate written
32
+ license agreement, these files are provided AS IS, WITHOUT WARRANTY OF
33
+ ANY KIND, including without any implied warranties of MERCHANTABILITY,
34
+ FITNESS FOR A PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT. As a
35
+ condition to your use of these files, you are solely responsible for
36
+ such use. Timber will have no liability to you for direct,
37
+ indirect, consequential, incidental, special, or punitive damages or
38
+ for lost profits or data.
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # Timber.io - Ruby Gem - Powerful Ruby Logging
2
+
3
+ <p align="center" style="background: #140f2a;">
4
+ <a href="http://github.com/timberio/timber-ruby"><img src="http://res.cloudinary.com/timber/image/upload/c_scale,w_537/v1464797600/how-it-works_sfgfjp.gif" /></a>
5
+ </p>
6
+
7
+ [![CircleCI](https://circleci.com/gh/timberio/timber-ruby.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/timberio/timber-ruby/tree/master)
8
+ [![Coverage Status](https://coveralls.io/repos/github/timberio/timber-ruby/badge.svg?branch=master)](https://coveralls.io/github/timberio/timber-ruby?branch=master)
9
+ [![Code Climate](https://codeclimate.com/github/timberio/timber-ruby/badges/gpa.svg)](https://codeclimate.com/github/timberio/timber-ruby)
10
+ [![View docs](https://img.shields.io/badge/docs-viewdocs-blue.svg?style=flat-square "Viewdocs")](http://www.rubydoc.info/github/timberio/timber-ruby)
11
+
12
+ **Note: Timber is in alpha testing, if interested in joining, please visit http://timber.io**
13
+
14
+ [Timber](http://timber.io) is a different kind of logging platform; it goes beyond traditional logging by enriching your logs with *app* context. Turning them into rich structured events without altering the essence of logging. See for yourself at [timber.io](http://timber.io).
15
+
16
+ ## Install
17
+
18
+ To ensure logs are transported efficiently, Timber offers a variety of solutions. Please choose your preferred method below:
19
+
20
+ 1. **[Rails on Heroku](docs/installation/rails_on_heroku.md)** - Takes advantage of Heroku's logplex.
21
+ 2. **[Rails over HTTP](docs/installation/rails_over_http.md)** - Quick and easy. No agent. Deploy and go.
22
+ 3. ...more coming soon!
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'rspec/core/rake_task'
2
+ RSpec::Core::RakeTask.new(:spec) do |t|
3
+ t.rspec_opts = '--order random'
4
+ end
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ * Task for tailing logs in the console?
2
+ * Task for opening web / desktop app?
3
+ * Track memory usage, but do it efficiently. Random process stat drops?
4
+ * Re-think how the library logs itself. Should that be captured as well?
@@ -0,0 +1,26 @@
1
+ ## Benchmarking & Performance
2
+
3
+ Timber was designed with an obsessive focus on performance and resource usage. In the `/benchmark` folder you'll find benchmarking tests.
4
+
5
+
6
+ ```console
7
+ +---------------------------+------------+-----------------+--------------+
8
+ | Timber benchmarking. 10 requests per test. Times are "real" CPU time. |
9
+ +---------------------------+------------+-----------------+--------------+
10
+ | | Total | Per request avg | Per log line |
11
+ +---------------------------+------------+-----------------+--------------+
12
+ | Control | 0.0077939 | 0.00077939 | 2.598e-05 |
13
+ | Timber probes only | 0.00694394 | 0.00069439 | 2.315e-05 |
14
+ | Timber probes and logging | 0.00897193 | 0.00089719 | 2.991e-05 |
15
+ +---------------------------+------------+-----------------+--------------+
16
+ ```
17
+
18
+ 1. `Control` - This is vanilla rails app without Timber installed.
19
+ 2. `Timber probels only` - The same rails app but with *only* the `Timber::Probes` installed, isolating probes performance.
20
+ 3. `Timber probes and logging` - Testing the full Timber library, probes and adding context to each log line.
21
+
22
+ The benchmark can be run yourself via:
23
+
24
+ ```console
25
+ $ appraisal ruby benchmark/rails_request.rb
26
+ ```
@@ -0,0 +1,68 @@
1
+ #----------------------------------------------------------
2
+ # This file demonstrates Rails performance with and without
3
+ # the Timber library installed. Timber was designed with an
4
+ # obsessive focus on performance and resource usage. The
5
+ # below benchmarking test reveals this. A few notes:
6
+ # 1. Both loggers are set to log to the same device.
7
+ # 2. The log level is set to debug to maximize logging output.
8
+ # 3. Timber is run last so that we can insert the probes after.
9
+ # This ensures Timber does not affect the environment at all.
10
+ # ---------------------------------------------------------
11
+
12
+ $:.unshift File.dirname(__FILE__)
13
+ require "support/rails"
14
+ require "benchmark"
15
+ require "logger"
16
+ require "terminal-table"
17
+
18
+ def line_count(io)
19
+ io.rewind
20
+ io.read.split("\n").size
21
+ end
22
+ ITERATIONS = 10
23
+ PRECISION = 8
24
+ test = Proc.new { ITERATIONS.times { Support::Rails.dispatch_rails_request("/") } }
25
+
26
+ # Set a default logger
27
+ io = StringIO.new
28
+ Support::Rails.set_logger(io)
29
+
30
+ # Control
31
+ control = Benchmark.measure("Control", &test)
32
+ control_per_req = control.real / ITERATIONS
33
+ log_line_count = line_count(io)
34
+ control_per_line = control_per_req / log_line_count
35
+
36
+ # Reset logger and insert probes
37
+ io = StringIO.new
38
+ Support::Rails.set_logger(io)
39
+ Timber::Config.enabled = true
40
+ Timber::Bootstrap.bootstrap!(RailsApp.config.app_middleware, ::Rails::Rack::Logger)
41
+
42
+ # Probes only
43
+ probes_only = Benchmark.measure("Timber probes only", &test)
44
+ probes_only_per_req = probes_only.real / ITERATIONS
45
+ probes_only_per_req_diff = probes_only_per_req - control_per_req
46
+ log_line_count = line_count(io)
47
+ probes_only_per_line = probes_only_per_req / log_line_count
48
+
49
+ # Install Timber
50
+ io = StringIO.new
51
+ Support::Rails.set_timber_logger(io)
52
+
53
+ # With timber logger
54
+ with_timber = Benchmark.measure("Timber probes and logging", &test)
55
+ with_timber_per_req = with_timber.real / ITERATIONS
56
+ with_timber_per_req_diff = with_timber_per_req - probes_only_per_req
57
+ log_line_count = line_count(io)
58
+ with_timber_per_line = with_timber_per_req / log_line_count
59
+
60
+ title = "Timber benchmarking. #{ITERATIONS} requests per test. Times are \"real\" CPU time."
61
+ table = Terminal::Table.new(:title => title) do |t|
62
+ t << [nil, "Total", "Per request avg", "Per log line"]
63
+ t.add_separator
64
+ t << [control.label, control.real.round(PRECISION), control_per_req.round(PRECISION), control_per_line.round(PRECISION)]
65
+ t << [probes_only.label, probes_only.real.round(PRECISION), probes_only_per_req.round(PRECISION), probes_only_per_line.round(PRECISION)]
66
+ t << [with_timber.label, with_timber.real.round(PRECISION), with_timber_per_req.round(PRECISION), with_timber_per_line.round(PRECISION)]
67
+ end
68
+ puts table
@@ -0,0 +1,69 @@
1
+ require "rails"
2
+ require "action_controller"
3
+ require "timber"
4
+ require "stringio"
5
+
6
+ # Helper methods
7
+ module Support
8
+ module Rails
9
+ def self.dispatch_rails_request(path)
10
+ application = ::Rails.application
11
+ env = application.respond_to?(:env_config) ? application.env_config.clone : application.env_defaults.clone
12
+ env["rack.request.cookie_hash"] = {}.with_indifferent_access
13
+ ::Rack::MockRequest.new(application).get(path, env)
14
+ end
15
+
16
+ def self.set_logger(log_dev)
17
+ ::Rails.logger = Timber::Frameworks::Rails.logger(log_dev)
18
+ ::Rails.logger.level = ::Logger::DEBUG # log everything
19
+ end
20
+
21
+ def self.set_timber_logger(log_dev)
22
+ ::Rails.logger = Timber::Logger.new(Timber::LogDevices::IO.new(log_dev))
23
+ ::Rails.logger.level = ::Logger::DEBUG # log everything
24
+ end
25
+ end
26
+ end
27
+
28
+ # Disable by default
29
+ Timber::Config.enabled = false
30
+
31
+ # Setup default rails logger with StringIO.
32
+ # This ensures that the log data isn't output, but the level is sufficient
33
+ # to be logged.
34
+ Support::Rails.set_logger(StringIO.new)
35
+
36
+ # Base rails app
37
+ class RailsApp < Rails::Application
38
+ if ::Rails.version =~ /^3\./
39
+ config.secret_token = '1e05af2b349457936a41427e63450937'
40
+ else
41
+ config.secret_key_base = '1e05af2b349457936a41427e63450937'
42
+ end
43
+ config.active_support.deprecation = :stderr
44
+ config.eager_load = false
45
+ end
46
+
47
+ # Start the app to get initialization out of the way
48
+ RailsApp.initialize!
49
+
50
+ # Setup a controller
51
+ class PagesController < ActionController::Base
52
+ layout nil
53
+
54
+ def index
55
+ render json: {}
56
+ end
57
+
58
+ def method_for_action(action_name)
59
+ action_name
60
+ end
61
+ end
62
+
63
+ # Some routes
64
+ ::RailsApp.routes.draw do
65
+ get '/' => 'pages#index'
66
+ end
67
+
68
+ # Dispatch a request to get the initial caching / loading out of the way
69
+ Support::Rails.dispatch_rails_request("/")
data/circle.yml ADDED
@@ -0,0 +1,27 @@
1
+ machine:
2
+ environment:
3
+ COVERALLS_REPO_TOKEN: fzLA6t2EFT4KBemv3du0AdHGcqTzyRzlr
4
+
5
+ dependencies:
6
+ override:
7
+ - PATH=/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/bin:$PATH rvm-exec 1.9.3 bundle install
8
+ - PATH=/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/bin:$PATH rvm-exec 1.9.3 appraisal rails-3.0.X bundle install
9
+ - PATH=/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/bin:$PATH rvm-exec 1.9.3 appraisal rails-3.1.X bundle install
10
+ - PATH=/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/bin:$PATH rvm-exec 1.9.3 appraisal rails-3.2.X bundle install
11
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 bundle install
12
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 appraisal rails-4.0.X bundle install
13
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 appraisal rails-4.1.X bundle install
14
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 appraisal rails-4.2.X bundle install
15
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 appraisal rails-5.0.X bundle install
16
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 appraisal rails-edge bundle install
17
+
18
+ test:
19
+ override:
20
+ - PATH=/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/bin:$PATH rvm-exec 1.9.3 appraisal rails-3.0.X rake spec
21
+ - PATH=/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/bin:$PATH rvm-exec 1.9.3 appraisal rails-3.1.X rake spec
22
+ - PATH=/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/bin:$PATH rvm-exec 1.9.3 appraisal rails-3.2.X rake spec
23
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 appraisal rails-4.0.X rake spec
24
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 appraisal rails-4.1.X rake spec
25
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 appraisal rails-4.2.X rake spec
26
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 appraisal rails-5.0.X rake spec
27
+ - PATH=/home/ubuntu/.rvm/gems/ruby-2.3.0/bin:$PATH rvm-exec 2.3.0 appraisal rails-edge rake spec
@@ -0,0 +1,31 @@
1
+ # Rails on Heroku Installation Instructions
2
+
3
+ If your Rails app is on Heroku, you'll want to take advantage of the Heroku logplex. This allows you to efficiently write your logs to STDOUT while Heroku handles transport of your logs to Timber.
4
+
5
+ ## 1. Install the gem
6
+
7
+ Add timber to your Gemfile:
8
+
9
+ ```
10
+ gem 'timber-ruby'
11
+ ```
12
+
13
+ ## 2. Add the logger to your environment files:
14
+
15
+ ```ruby
16
+ # config/environments/production.rb (or staging, etc)
17
+ config.logger = Timber::Logger.new(Timber::LogDevices::HerokuLogplex.new))
18
+ ```
19
+
20
+ * Awesome note: by default, Timber uses a log format that enriches your logs without changing how the look in your terminal! Try it out with `heroku logs --tail`.
21
+ * You can change this default formatting, and other advanced options, by checking out the [Timber::LogDevices::HerokuLogplex docs](http://www.rubydoc.info/github/timberio/timber-ruby/master/Timber/LogDevices/HerokuLogplex).
22
+
23
+ ## 3. Lastly, setup your log drain
24
+
25
+ ```console
26
+ $ heroku drains:add https://<your-timber-api-key>@api.timber.io/heroku/logplex_frames \
27
+ --app=<my-app-name>
28
+ ```
29
+
30
+ * Replace `<your-timber-api-key>` with your actual key. You can obtain it [here](https://timber.io).
31
+ * Replace `<my-app-name>` with your heroku app name.
@@ -0,0 +1,22 @@
1
+ # Rails Over HTTP Installation Instructions
2
+
3
+ The quickest and easiesy way to get up and running with Timber. No agent to install, deploy and go!
4
+
5
+ ## 1. Install the gem
6
+
7
+ Add timber to your Gemfile:
8
+
9
+ ```
10
+ gem 'timber-ruby'
11
+ ```
12
+
13
+ ## 2. Add the logger to your environment files:
14
+
15
+ ```ruby
16
+ # config/environments/production.rb (or staging, etc)
17
+ config.logger = Timber::Logger.new(Timber::LogDevices::HTTP.new(ENV['TIMBER_KEY'])))
18
+ ```
19
+
20
+ * You can obtain your Timber API key [here](https://timber.io).
21
+ * If you set `ENV['TIMBER_KEY']`, you do not have to pass it as an argument. The example above provides it for explicitness.
22
+ * The `Timber::Logger.new` function handles instantiating the Rails logger properly for your Rails version, including wrapping the logger in `ActiveSupport::TaggedLogger.new` (if available). It's equivalent to `Timber::Logger.new(ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(Timber::LogDevices::HTTP.new(ENV['TIMBER_KEY'])))`.
@@ -0,0 +1,25 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 3.0.20"
6
+
7
+ group :test do
8
+ gem "appraisal"
9
+ gem "coveralls", :require => false
10
+ gem "json", "~> 1"
11
+ gem "pry"
12
+ gem "rails_stdout_logging"
13
+ gem "rake"
14
+ gem "rspec", "~> 3.4"
15
+ gem "rspec-its"
16
+ gem "simplecov", :require => false
17
+ gem "sqlite3"
18
+ gem "terminal-table"
19
+ gem "timecop"
20
+ gem "webmock", "~> 2.0.3"
21
+ gem "rest-client", "~> 1.8"
22
+ gem "tins", "~> 1.6.0"
23
+ end
24
+
25
+ gemspec :path => "../"
@@ -0,0 +1,25 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 3.1.12"
6
+
7
+ group :test do
8
+ gem "appraisal"
9
+ gem "coveralls", :require => false
10
+ gem "json", "~> 1"
11
+ gem "pry"
12
+ gem "rails_stdout_logging"
13
+ gem "rake"
14
+ gem "rspec", "~> 3.4"
15
+ gem "rspec-its"
16
+ gem "simplecov", :require => false
17
+ gem "sqlite3"
18
+ gem "terminal-table"
19
+ gem "timecop"
20
+ gem "webmock", "~> 2.0.3"
21
+ gem "rest-client", "~> 1.8"
22
+ gem "tins", "~> 1.6.0"
23
+ end
24
+
25
+ gemspec :path => "../"
@@ -0,0 +1,25 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 3.2.22"
6
+
7
+ group :test do
8
+ gem "appraisal"
9
+ gem "coveralls", :require => false
10
+ gem "json", "~> 1"
11
+ gem "pry"
12
+ gem "rails_stdout_logging"
13
+ gem "rake"
14
+ gem "rspec", "~> 3.4"
15
+ gem "rspec-its"
16
+ gem "simplecov", :require => false
17
+ gem "sqlite3"
18
+ gem "terminal-table"
19
+ gem "timecop"
20
+ gem "webmock", "~> 2.0.3"
21
+ gem "rest-client", "~> 1.8"
22
+ gem "tins", "~> 1.6.0"
23
+ end
24
+
25
+ gemspec :path => "../"
@@ -0,0 +1,26 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "minitest"
6
+ gem "rails", "~> 4.0.13"
7
+
8
+ group :test do
9
+ gem "appraisal"
10
+ gem "coveralls", :require => false
11
+ gem "json", "~> 1"
12
+ gem "pry"
13
+ gem "rails_stdout_logging"
14
+ gem "rake"
15
+ gem "rspec", "~> 3.4"
16
+ gem "rspec-its"
17
+ gem "simplecov", :require => false
18
+ gem "sqlite3"
19
+ gem "terminal-table"
20
+ gem "timecop"
21
+ gem "webmock", "~> 2.0.3"
22
+ gem "rest-client", "~> 1.8"
23
+ gem "tins", "~> 1.6.0"
24
+ end
25
+
26
+ gemspec :path => "../"
@@ -0,0 +1,26 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "minitest"
6
+ gem "rails", "~> 4.1.15"
7
+
8
+ group :test do
9
+ gem "appraisal"
10
+ gem "coveralls", :require => false
11
+ gem "json", "~> 1"
12
+ gem "pry"
13
+ gem "rails_stdout_logging"
14
+ gem "rake"
15
+ gem "rspec", "~> 3.4"
16
+ gem "rspec-its"
17
+ gem "simplecov", :require => false
18
+ gem "sqlite3"
19
+ gem "terminal-table"
20
+ gem "timecop"
21
+ gem "webmock", "~> 2.0.3"
22
+ gem "rest-client", "~> 1.8"
23
+ gem "tins", "~> 1.6.0"
24
+ end
25
+
26
+ gemspec :path => "../"
@@ -0,0 +1,26 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "minitest"
6
+ gem "rails", "~> 4.2.7"
7
+
8
+ group :test do
9
+ gem "appraisal"
10
+ gem "coveralls", :require => false
11
+ gem "json", "~> 1"
12
+ gem "pry"
13
+ gem "rails_stdout_logging"
14
+ gem "rake"
15
+ gem "rspec", "~> 3.4"
16
+ gem "rspec-its"
17
+ gem "simplecov", :require => false
18
+ gem "sqlite3"
19
+ gem "terminal-table"
20
+ gem "timecop"
21
+ gem "webmock", "~> 2.0.3"
22
+ gem "rest-client", "~> 1.8"
23
+ gem "tins", "~> 1.6.0"
24
+ end
25
+
26
+ gemspec :path => "../"
@@ -0,0 +1,26 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "minitest"
6
+ gem "rails", "~> 5.0.0"
7
+
8
+ group :test do
9
+ gem "appraisal"
10
+ gem "coveralls", :require => false
11
+ gem "json", "~> 1"
12
+ gem "pry"
13
+ gem "rails_stdout_logging"
14
+ gem "rake"
15
+ gem "rspec", "~> 3.4"
16
+ gem "rspec-its"
17
+ gem "simplecov", :require => false
18
+ gem "sqlite3"
19
+ gem "terminal-table"
20
+ gem "timecop"
21
+ gem "webmock", "~> 2.0.3"
22
+ gem "rest-client", "~> 1.8"
23
+ gem "tins", "~> 1.6.0"
24
+ end
25
+
26
+ gemspec :path => "../"
@@ -0,0 +1,27 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rack", :github => "rack/rack", :branch => "master"
6
+ gem "arel", :github => "rails/arel", :branch => "master"
7
+ gem "rails", :github => "rails/rails", :branch => "master"
8
+
9
+ group :test do
10
+ gem "appraisal"
11
+ gem "coveralls", :require => false
12
+ gem "json", "~> 1"
13
+ gem "pry"
14
+ gem "rails_stdout_logging"
15
+ gem "rake"
16
+ gem "rspec", "~> 3.4"
17
+ gem "rspec-its"
18
+ gem "simplecov", :require => false
19
+ gem "sqlite3"
20
+ gem "terminal-table"
21
+ gem "timecop"
22
+ gem "webmock", "~> 2.0.3"
23
+ gem "rest-client", "~> 1.8"
24
+ gem "tins", "~> 1.6.0"
25
+ end
26
+
27
+ gemspec :path => "../"