timber 2.1.5 → 2.1.6

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: 73567629c6afb913426d711c96cb394d9e2bf741
4
- data.tar.gz: 952d3e7d73d9de740abdaf536d3eb3fe985024e4
3
+ metadata.gz: baa611c5defcf24154ffcb829af28252a93b7eda
4
+ data.tar.gz: 08ecbf18b034d297b1d184c362bb6789b7655df6
5
5
  SHA512:
6
- metadata.gz: 5ddc053cd804b4121e27fd91128b9f950270a85fc10a316a57f9a618000c46e5fbe07627a492af9574d7c77096004da07b21343263155cf40dc534f1301174d5
7
- data.tar.gz: 2f063f0a6ec629265f4fbd1f2d7de23392d81faaef3a671fc02129bdfa984ddbda873391ca118040cda3a27fe61ad599a4920ce9014b05e2da757bbb1375ca61
6
+ metadata.gz: aec84b46f8264c4ea92413c5c85c3277751691148048bb98a8f13554473301429b783c04c1fe5037e13985f3489042fe682dde07064fb59f5601c6cce8a828b6
7
+ data.tar.gz: 716a20f56eec22a0447d2a7752b21e5a5de98d887991325ff0a7dad3253ef4cfba89d13ca36f48f9f09153d06d8f37635c0eb18d136739d117fdc745f876cd56
data/README.md CHANGED
@@ -4,17 +4,15 @@
4
4
  [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/github/timberio/timber-ruby)
5
5
  [![Build Status](https://travis-ci.org/timberio/timber-ruby.svg?branch=master)](https://travis-ci.org/timberio/timber-ruby)
6
6
 
7
- [Timber.io](https://timber.io) is a simple cloud-based logging platform built for developers.
8
- This is our official Ruby library.
7
+ [Timber](https://timber.io) is a cloud-based logging system that integrates directly with your
8
+ Ruby app to capture context and metadata without parsing. This produces rich, clean, readable logs
9
+ that are easier to search and use:
9
10
 
10
- ## Overview
11
-
12
- Ruby logs are broken. They're noisy, unparesable, and in the context of multiple servers and processes, unreadable. Current logging systems built for ops engineers haven't helped. This is why we built Timber. It's a different approach to Ruby logging. Instead of prefixing your logs with noisy tags, Timber integrates directly with your application, capturing rich context and metadata without altering your logs. This makes your logs easy to [search, use, and _read_](#do-amazing-things-with-your-logs), giving you _complete_ insight into your Ruby app.
13
-
14
- 1. [**Easy setup** - `bundle exec timber install`](#installation)
15
- 2. [**Powerful logging**](#usage)
16
- 3. [**Seamlessly integrates with popular libraries and frameworks**](#integrations)
17
- 4. [**Do amazing things with your Ruby logs**](#do-amazing-things-with-your-logs)
11
+ 1. [**Installation** - One command: `bundle exec timber install`](#installation)
12
+ 2. [**Usage** - Simple yet powerful API](#usage)
13
+ 3. [**Integrations** - Automatic context and metadata for your existing logs](#integrations)
14
+ 4. [**The Timber Console** - Designed for Ruby developers](#the-timber-console)
15
+ 5. [**Get things done with your logs 💪**](#get-things-done-with-your-logs)
18
16
 
19
17
 
20
18
  ## Installation
@@ -91,7 +89,7 @@ have to maually set these contexts except in special circumstances.
91
89
  ### How to use it
92
90
 
93
91
  ```ruby
94
- logger.with_context(job: {id: 123}) do
92
+ Timber.with_context(job: {id: 123}) do
95
93
  logger.info("Background job execution started")
96
94
  # ... code here
97
95
  logger.info("Background job execution completed")
@@ -120,7 +118,7 @@ you are unsure how you'll need to use your data in the future.
120
118
  Below is a contrived example of timing a background job:
121
119
 
122
120
  ```ruby
123
- timer = Timber::Timer.start
121
+ timer = Timber.start_timer
124
122
  # ... code to time ...
125
123
  logger.info("Processed background job", background_job: {time_ms: timer})
126
124
  ```
@@ -162,8 +160,7 @@ option for anyone transitioning from lograge.
162
160
  ```ruby
163
161
  # config/initializers/timber.rb
164
162
 
165
- config = Timber::Config.instance
166
- config.logrageify!()
163
+ Timber.config.logrageify!()
167
164
  ```
168
165
 
169
166
  ### How it works
@@ -192,11 +189,10 @@ Internally this is equivalent to:
192
189
  ```ruby
193
190
  # config/initializers/timber.rb
194
191
 
195
- config = Timber::Config.instance
196
- config.integrations.action_controller.silence = true
197
- config.integrations.action_view.silence = true
198
- config.integrations.active_record.silence = true
199
- config.integrations.rack.http_events.collapse_into_single_event = true
192
+ Timber.config.integrations.action_controller.silence = true
193
+ Timber.config.integrations.action_view.silence = true
194
+ Timber.config.integrations.active_record.silence = true
195
+ Timber.config.integrations.rack.http_events.collapse_into_single_event = true
200
196
  ```
201
197
 
202
198
  ### Pro-tip: Keep controller call logs (recommended)
@@ -207,10 +203,9 @@ from lograge with the following settings:
207
203
  ```ruby
208
204
  # config/initializers/timber.rb
209
205
 
210
- config = Timber::Config.instance
211
- config.integrations.action_view.silence = true
212
- config.integrations.active_record.silence = true
213
- config.integrations.rack.http_events.collapse_into_single_event = true
206
+ Timber.config.integrations.action_view.silence = true
207
+ Timber.config.integrations.active_record.silence = true
208
+ Timber.config.integrations.rack.http_events.collapse_into_single_event = true
214
209
  ```
215
210
 
216
211
  This does _not_ silence the controller call log event. This is because Timber captures the
@@ -235,8 +230,7 @@ The following will silence all `[GET] /_health` requests:
235
230
  ```ruby
236
231
  # config/initializers/timber.rb
237
232
 
238
- config = Timber::Config.instance
239
- config.integrations.rack.http_events.silence_request = lambda do |rack_env, rack_request|
233
+ Timber.config.integrations.rack.http_events.silence_request = lambda do |rack_env, rack_request|
240
234
  rack_request.path == "/_health"
241
235
  end
242
236
  ```
@@ -264,8 +258,7 @@ you can do so like:
264
258
  ```ruby
265
259
  # config/initializers/timber.rb
266
260
 
267
- config = Timber::Config.instance
268
- config.integrations.rack.user_context.custom_user_hash = lambda do |rack_env|
261
+ Timber.config.integrations.rack.user_context.custom_user_hash = lambda do |rack_env|
269
262
  user = rack_env['warden'].user
270
263
  if user
271
264
  {
@@ -324,9 +317,9 @@ support:
324
317
  8. ...more coming soon! Make a request by [opening an issue](https://github.com/timberio/timber-ruby/issues/new)
325
318
 
326
319
 
327
- ## Do amazing things with your logs
320
+ ## Get things done with your logs
328
321
 
329
- Unlock the potential of your logs:
322
+ Logging features every developer needs:
330
323
 
331
324
  1. [**Powerful searching.** - Find what you need faster.](https://timber.io/docs/app/console/searching)
332
325
  2. [**Live tail users.** - Easily solve customer issues.](https://timber.io/docs/app/console/tail-a-user)
@@ -18,4 +18,19 @@ require "timber/timer"
18
18
  require "timber/frameworks"
19
19
 
20
20
  module Timber
21
+ # Access the main configuration object. Please see {{Timber::Config}} for more details.
22
+ def self.config
23
+ Config.instance
24
+ end
25
+
26
+ # Starts a timer for timing events. Please see {{Timber::Timber.start}} for more details.
27
+ def self.start_timer
28
+ Timer.start
29
+ end
30
+
31
+ # Adds context to all logs written within the passed block. Please see
32
+ # {{Timber::CurrentContext.with}} for a more detailed description with examples.
33
+ def self.with_context(context, &block)
34
+ CurrentContext.with(context, &block)
35
+ end
21
36
  end
@@ -214,8 +214,7 @@ module Timber
214
214
  super
215
215
  end
216
216
 
217
- # Convenience method for adding context. Please see {{Timber::CurrentContext.with}} for
218
- # a more detailed description and examples.
217
+ # @private
219
218
  def with_context(context, &block)
220
219
  Timber::CurrentContext.with(context, &block)
221
220
  end
@@ -1,3 +1,3 @@
1
1
  module Timber
2
- VERSION = "2.1.5"
2
+ VERSION = "2.1.6"
3
3
  end
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.5
4
+ version: 2.1.6
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-08-20 00:00:00.000000000 Z
11
+ date: 2017-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack