timber 2.1.0.rc5 → 2.1.0.rc6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bb5abd9ff785281715e45354703c1b9c3f2b25b
4
- data.tar.gz: 347d46a12f3880a73e28d595554c5f838bb59eb1
3
+ metadata.gz: 7a643334c71fa0882be4dff042d82a30e2b46a6a
4
+ data.tar.gz: 5fa71626d12aa84e4235de2134c4dead24de3bd3
5
5
  SHA512:
6
- metadata.gz: 553e015f5deecc539ec6437e7ae661f2e75d0d3bee6e92b095efb05f5ce180a7bc7ba7d710ca5749f022d61e3ed26e1f0b02cb1e778693f1f5553cf15570d9c8
7
- data.tar.gz: 979086f4ac6d10bb38276696eed64b3ccf9cb79b2b057c8f83d3e1e045959735e4d9ab0cc47874cd21d2e4ba0bebd87382576436e94aff15204c0d9dcccc2944
6
+ metadata.gz: b51e148b80b8054a020ff4a3e6a0d0044755da44373360aedda5c3c495e53c4b920d4e697bfb25f778bccc7f1fe39c1e14738af3813a312dfc8ebb4b39579b57
7
+ data.tar.gz: 59b9e2d8caf5072fc05a17939c734e5f4fda0800f8b6b92a4f8acffd28ae0951e35561f2831a3bc782969690f52ba8a45307eceb7e27d056306e515ae3e90206
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ Please see [https://github.com/timberio/timber-ruby/releases](https://github.com/timberio/timber-ruby/releases) for library specific changes.
4
+
5
+ For all Timber changes see [https://timber.io/changelog](https://timber.io/changelog).
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![ISC License](https://img.shields.io/badge/license-ISC-ff69b4.svg)](LICENSE.md)
4
4
  [![Build Status](https://travis-ci.org/timberio/timber-ruby.svg?branch=master)](https://travis-ci.org/timberio/timber-ruby)
5
- [![Build Status](https://travis-ci.org/timberio/timber-ruby.svg?branch=master)](https://travis-ci.org/timberio/timber-ruby)
6
5
  [![Code Climate](https://codeclimate.com/github/timberio/timber-ruby/badges/gpa.svg)](https://codeclimate.com/github/timberio/timber-ruby)
7
6
  [![View docs](https://img.shields.io/badge/docs-viewdocs-blue.svg?style=flat-square "Viewdocs")](http://www.rubydoc.info/github/timberio/timber-ruby)
8
7
 
@@ -198,8 +197,8 @@ end
198
197
 
199
198
  Aggregates destroy details, and with Timber capturing metrics and timings is just logging events.
200
199
  Timber is built on modern big-data principles, it can calculate aggregates across terrabytes of
201
- data in seconds. Don't reduce the quality of your data because the system processing
202
- your data is limited.
200
+ data in seconds. Don't reduce the quality of your log data to accomodate a restrive
201
+ logging system.
203
202
 
204
203
  Here's a timing example. Notice how Timber automatically calculates the time and adds the timing
205
204
  to the message.
@@ -213,7 +212,7 @@ logger.info("Processed background job", background_job: {time_ms: timer})
213
212
  # => Processed background job in 54.2ms @metadata {"level": "info", "event": {"background_job": {"time_ms": 54.2}}}
214
213
  ```
215
214
 
216
- And of course, `time_ms` can also take a `Float`:
215
+ And of course, `time_ms` can also take a `Float` or `Fixnum`:
217
216
 
218
217
  ```ruby
219
218
  logger.info("Processed background job", background_job: {time_ms: 45.6})
@@ -296,10 +295,10 @@ config.integrations.rack.http_events.collapse_into_single_event = true
296
295
  ```
297
296
 
298
297
  This does _not_ silence the controller call log event. This is because Timber captures the
299
- parameters passed to the controller, which is very valuable when debugging.
298
+ parameters passed to the controller, which are generally valuable when debugging.
300
299
 
301
- For a full list of integrations and settings, see
302
- [Timber::Integrations](http://www.rubydoc.info/github/timberio/timber-ruby/Timber/Integrations)
300
+ For a full list of integration settings, see
301
+ [Timber::Config::Integrations](http://www.rubydoc.info/github/timberio/timber-ruby/Timber/Config/Integrations)
303
302
 
304
303
  ---
305
304
 
@@ -3,14 +3,15 @@ require "timber/cli/file_helper"
3
3
  module Timber
4
4
  class CLI
5
5
  class ConfigFile
6
- attr_reader :path
6
+ attr_reader :path, :file_helper
7
7
 
8
- def initialize(path)
8
+ def initialize(path, file_helper)
9
9
  @path = path
10
+ @file_helper = file_helper
10
11
  end
11
12
 
12
13
  def create!
13
- FileHelper.write(path, content)
14
+ file_helper.write(path, content)
14
15
  end
15
16
 
16
17
  def exists?
@@ -12,7 +12,7 @@ module Timber
12
12
  module Installers
13
13
  class ConfigFile < Installer
14
14
  def run(app, path)
15
- config_file = Timber::CLI::ConfigFile.new(path)
15
+ config_file = Timber::CLI::ConfigFile.new(path, file_helper)
16
16
 
17
17
  if config_file.exists?
18
18
  io.puts ""
@@ -29,7 +29,7 @@ module Timber
29
29
  Timber::Integrations::ActionController
30
30
  end
31
31
 
32
- # Convenience method for accessing the {Timber::IIntegrations::ActionView} class
32
+ # Convenience method for accessing the {Timber::Integrations::ActionView} class
33
33
  # specific configuration.
34
34
  #
35
35
  # @example
@@ -39,7 +39,7 @@ module Timber
39
39
  Timber::Integrations::ActionView
40
40
  end
41
41
 
42
- # Convenience method for accessing the {Timber::IIntegrations::ActiveRecord} class
42
+ # Convenience method for accessing the {Timber::Integrations::ActiveRecord} class
43
43
  # specific configuration.
44
44
  #
45
45
  # @example
@@ -49,7 +49,7 @@ module Timber
49
49
  Timber::Integrations::ActiveRecord
50
50
  end
51
51
 
52
- # Convenience method for accessing the various `Timber::IIntegrations::Rack::*`
52
+ # Convenience method for accessing the various `Timber::Integrations::Rack::*`
53
53
  # classes. See {Rack} for a list of methods available.
54
54
  #
55
55
  # @example
@@ -28,7 +28,7 @@ module Timber
28
28
  @data = attributes[:data] || raise(ArgumentError.new(":data is required"))
29
29
  end
30
30
 
31
- # Builds a hash representation of containing simply objects, suitable for serialization.
31
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
32
32
  def as_json(options = {})
33
33
  {Timber::Util::Object.try(type, :to_sym) => data}
34
34
  end
@@ -3,15 +3,15 @@ require "timber/context"
3
3
  module Timber
4
4
  module Contexts
5
5
  # The HTTP context adds data about the current HTTP request being processed to your logs.
6
- # This allows your to tail and filter by this data. A very useful piece of data this
6
+ # This allows you to tail and filter by this data. A very useful piece of data this
7
7
  # captures is the request ID. This gives you the ability to trace requests and view logs
8
8
  # for a specific request only. For example, say you've searched your logs and found the
9
9
  # specific line you are looking for, but it lacks context. With Timber you can simply
10
10
  # click the request ID and "zoom out" to view all logs for that request. This gives you
11
11
  # complete picture of how the log line in questio was generated.
12
12
  #
13
- # @note This context should be installed automatically through integrations,
14
- # such as the {Intregrations::Rack::HTTPContext} rack middleware.
13
+ # @note This context should be installed automatically through the,
14
+ # {Intregrations::Rack::HTTPContext} Rack middleware.
15
15
  class HTTP < Context
16
16
  @keyspace = :http
17
17
 
@@ -24,7 +24,7 @@ module Timber
24
24
  @request_id = attributes[:request_id]
25
25
  end
26
26
 
27
- # Builds a hash representation of containing simply objects, suitable for serialization.
27
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
28
28
  def as_json(_options = {})
29
29
  {:method => method, :path => path, :remote_addr => remote_addr, :request_id => request_id}
30
30
  end
@@ -28,7 +28,7 @@ module Timber
28
28
  @name = attributes[:name]
29
29
  end
30
30
 
31
- # Builds a hash representation of containing simply objects, suitable for serialization.
31
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
32
32
  def as_json(_options = {})
33
33
  {id: Timber::Util::Object.try(id, :to_s), name: name}
34
34
  end
@@ -5,7 +5,8 @@ require "timber/util"
5
5
  module Timber
6
6
  module Contexts
7
7
  # The release context tracks application releases / versions / deploys.
8
- # To automatically set this context, see {.from_env}.
8
+ #
9
+ # @note To automatically set this context, see {.from_env}.
9
10
  class Release < Context
10
11
  @keyspace = :release
11
12
 
@@ -40,7 +41,7 @@ module Timber
40
41
  @version = attributes[:version]
41
42
  end
42
43
 
43
- # Builds a hash representation of containing simply objects, suitable for serialization.
44
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
44
45
  def as_json(_options = {})
45
46
  {commit_hash: commit_hash, created_at: created_at, version: version}
46
47
  end
@@ -20,7 +20,7 @@ module Timber
20
20
  @module_name = attributes[:module_name]
21
21
  end
22
22
 
23
- # Builds a hash representation of containing simply objects, suitable for serialization.
23
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
24
24
  def as_json(_options = {})
25
25
  {application: application, class_name: class_name, file: file, function: function,
26
26
  line: line, module_name: module_name}
@@ -3,7 +3,7 @@ require "timber/util"
3
3
 
4
4
  module Timber
5
5
  module Contexts
6
- # The session context adds the current session ID to your logs. This allows your
6
+ # The session context adds the current session ID to your logs. This allows you
7
7
  # to tail and filter logs by specific session IDs. Moreover, it gives you a unique
8
8
  # identifier to report on user activity by session. This way your logs can tell the
9
9
  # story of how many time a user has engaged your site.
@@ -19,7 +19,7 @@ module Timber
19
19
  @id = attributes[:id] || raise(ArgumentError.new(":id is required"))
20
20
  end
21
21
 
22
- # Builds a hash representation of containing simply objects, suitable for serialization.
22
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
23
23
  def as_json(_options = {})
24
24
  {id: Timber::Util::Object.try(id, :to_s)}
25
25
  end
@@ -4,6 +4,9 @@ require "timber/util"
4
4
  module Timber
5
5
  module Contexts
6
6
  # The system context tracks OS level process information, such as the process ID.
7
+ #
8
+ # @note This is tracked automatically in {CurrentContext}. When the current context
9
+ # is initialized, the system context gets added automatically.
7
10
  class System < Context
8
11
  @keyspace = :system
9
12
 
@@ -15,7 +18,7 @@ module Timber
15
18
  @pid = @pid.to_s
16
19
  end
17
20
 
18
- # Builds a hash representation of containing simply objects, suitable for serialization.
21
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
19
22
  def as_json(_options = {})
20
23
  {hostname: hostname, pid: Timber::Util::Object.try(pid, :to_s)}
21
24
  end
@@ -21,7 +21,7 @@ module Timber
21
21
  @email = attributes[:email]
22
22
  end
23
23
 
24
- # Builds a hash representation of containing simply objects, suitable for serialization.
24
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
25
25
  def as_json(_options = {})
26
26
  {id: Timber::Util::Object.try(id, :to_s), name: name, email: email}
27
27
  end
@@ -26,7 +26,7 @@ module Timber
26
26
  end
27
27
  alias to_h to_hash
28
28
 
29
- # Builds a hash representation of containing simply objects, suitable for serialization.
29
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
30
30
  def as_json(_options = {})
31
31
  {:controller_call => to_hash}
32
32
  end
@@ -41,7 +41,7 @@ module Timber
41
41
  end
42
42
  alias to_h to_hash
43
43
 
44
- # Builds a hash representation of containing simply objects, suitable for serialization.
44
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
45
45
  def as_json(_options = {})
46
46
  {:custom => to_hash}
47
47
  end
@@ -28,7 +28,7 @@ module Timber
28
28
  end
29
29
  alias to_h to_hash
30
30
 
31
- # Builds a hash representation of containing simply objects, suitable for serialization.
31
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
32
32
  def as_json(_options = {})
33
33
  {:exception => to_hash}
34
34
  end
@@ -33,7 +33,7 @@ module Timber
33
33
  end
34
34
  alias to_h to_hash
35
35
 
36
- # Builds a hash representation of containing simply objects, suitable for serialization.
36
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
37
37
  def as_json(_options = {})
38
38
  {:http_client_request => to_hash}
39
39
  end
@@ -28,7 +28,7 @@ module Timber
28
28
  end
29
29
  alias to_h to_hash
30
30
 
31
- # Builds a hash representation of containing simply objects, suitable for serialization.
31
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
32
32
  def as_json(_options = {})
33
33
  {:http_client_response => to_hash}
34
34
  end
@@ -30,7 +30,7 @@ module Timber
30
30
  end
31
31
  alias to_h to_hash
32
32
 
33
- # Builds a hash representation of containing simply objects, suitable for serialization.
33
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
34
34
  def as_json(_options = {})
35
35
  {:http_server_request => to_hash}
36
36
  end
@@ -26,7 +26,7 @@ module Timber
26
26
  end
27
27
  alias to_h to_hash
28
28
 
29
- # Builds a hash representation of containing simply objects, suitable for serialization.
29
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
30
30
  def as_json(_options = {})
31
31
  {:http_server_response => to_hash}
32
32
  end
@@ -21,7 +21,7 @@ module Timber
21
21
  end
22
22
  alias to_h to_hash
23
23
 
24
- # Builds a hash representation of containing simply objects, suitable for serialization.
24
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
25
25
  def as_json(_options = {})
26
26
  {:sql_query => to_hash}
27
27
  end
@@ -21,7 +21,7 @@ module Timber
21
21
  end
22
22
  alias to_h to_hash
23
23
 
24
- # Builds a hash representation of containing simply objects, suitable for serialization.
24
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
25
25
  def as_json(_options = {})
26
26
  {:template_render => to_hash}
27
27
  end
@@ -12,7 +12,7 @@ module Timber
12
12
  # A highly efficient log device that buffers and delivers log messages over HTTPS to
13
13
  # the Timber API. It uses batches, keep-alive connections, and msgpack to deliver logs with
14
14
  # high-throughput and little overhead. All log preparation and delivery is done asynchronously
15
- # in a thread as not to block application execution and efficient deliver logs for
15
+ # in a thread as not to block application execution and efficiently deliver logs for
16
16
  # multi-threaded environments.
17
17
  #
18
18
  # See {#initialize} for options and more details.
@@ -13,7 +13,7 @@ module Timber
13
13
  attr_reader :context_snapshot, :event, :level, :message, :progname, :tags, :time, :time_ms
14
14
 
15
15
  # Creates a log entry suitable to be sent to the Timber API.
16
- # @param severity [Integer] the log level / severity
16
+ # @param level [Integer] the log level / severity
17
17
  # @param time [Time] the exact time the log message was written
18
18
  # @param progname [String] the progname scope for the log message
19
19
  # @param message [String] Human readable log message.
@@ -37,7 +37,7 @@ module Timber
37
37
  @event = event
38
38
  end
39
39
 
40
- # Builds a hash representation of containing simply objects, suitable for serialization.
40
+ # Builds a hash representation containing simple objects, suitable for serialization (JSON).
41
41
  def as_json(options = {})
42
42
  options ||= {}
43
43
  hash = {
@@ -1,5 +1,9 @@
1
1
  # Timber and lograge are not compatible installed together. Using lograge
2
2
  # with the Timber.io *service* is perfectly fine, but not with the Timber *gem*.
3
+ #
4
+ # Timber does ship with a {Timber::Config#logrageify!} option that configures
5
+ # Timber to behave similarly to Lograge (silencing various logs). Check out
6
+ # the aforementioned method or the README for info.
3
7
  begin
4
8
  require "lograge"
5
9
 
@@ -1,3 +1,3 @@
1
1
  module Timber
2
- VERSION = "2.1.0.rc5"
2
+ VERSION = "2.1.0.rc6"
3
3
  end
@@ -1,14 +1,16 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Timber::CLI::ConfigFile, :rails_23 => true do
4
+ let(:api) { Timber::CLI::API.new("abcd1234") }
5
+ let(:file_helper) { @file_helper = Timber::CLI::FileHelper.new(api) }
4
6
  let(:path) { "config/initializers/timber.rb" }
5
- let(:config_file) { described_class.new(path) }
7
+ let(:config_file) { described_class.new(path, file_helper) }
6
8
  let(:initial_contents) { "# Timber.io Ruby Configuration - Simple Structured Logging\n#\n# ^ ^ ^ ^ ___I_ ^ ^ ^ ^ ^ ^ ^\n# /|\\/|\\/|\\ /|\\ /\\-_--\\ /|\\/|\\ /|\\/|\\/|\\ /|\\/|\\\n# /|\\/|\\/|\\ /|\\ / \\_-__\\ /|\\/|\\ /|\\/|\\/|\\ /|\\/|\\\n# /|\\/|\\/|\\ /|\\ |[]| [] | /|\\/|\\ /|\\/|\\/|\\ /|\\/|\\\n# -------------------------------------------------------------------\n# Website: https://timber.io\n# Documentation: https://timber.io/docs\n# Support: support@timber.io\n# -------------------------------------------------------------------\n\nconfig = Timber::Config.instance\n\n# Add additional configuration here.\n# For a full list of configuration options and their explanations see:\n# http://www.rubydoc.info/github/timberio/timber-ruby/Timber/Config\n\n" }
7
9
  let(:contents_hook) { "# Add additional configuration here." }
8
10
 
9
11
  describe ".create!" do
10
12
  it "should create" do
11
- expect(Timber::CLI::FileHelper).to receive(:write).with(path, initial_contents).exactly(1).times
13
+ expect(config_file.file_helper).to receive(:write).with(path, initial_contents).exactly(1).times
12
14
  config_file.create!
13
15
  end
14
16
  end
@@ -23,9 +23,9 @@ describe Timber::CLI::Installers::ConfigFile, :rails_23 => true do
23
23
  describe ".run" do
24
24
  it "should run properly" do
25
25
  path = "/path/to/file"
26
- config_file = Timber::CLI::ConfigFile.new(path)
26
+ config_file = Timber::CLI::ConfigFile.new(path, installer.file_helper)
27
27
 
28
- expect(Timber::CLI::ConfigFile).to receive(:new).with(path).and_return(config_file)
28
+ expect(Timber::CLI::ConfigFile).to receive(:new).with(path, installer.file_helper).and_return(config_file)
29
29
  expect(config_file).to receive(:exists?).exactly(1).times.and_return(false)
30
30
  expect(installer).to receive(:logrageify?).exactly(1).times.and_return(true)
31
31
  expect(config_file).to receive(:logrageify!).exactly(1).times
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.rc5
4
+ version: 2.1.0.rc6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timber Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-08 00:00:00.000000000 Z
11
+ date: 2017-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -134,7 +134,7 @@ files:
134
134
  - ".rspec"
135
135
  - ".travis.yml"
136
136
  - ".yardopts"
137
- - CHANGELOG
137
+ - CHANGELOG.md
138
138
  - Gemfile
139
139
  - LICENSE.md
140
140
  - README.md
data/CHANGELOG DELETED
@@ -1,3 +0,0 @@
1
- Please see https://github.com/timberio/timber-ruby/releases for library specific changes.
2
-
3
- For all Timber changes see https://timber.io/changelog.