timber 2.0.6 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timber/config.rb +31 -17
- data/lib/timber/util/http_event.rb +6 -2
- data/lib/timber/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8e5de46982d4346797f2fcefba7f45d601bc6cd
|
4
|
+
data.tar.gz: 2a46a4fbc36cb8b6de0901cb138aeb7249ddd931
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81c9834d338f1d54f15df5c36802e761c3725da1cc36de4c46992fc7cc536ff6d0630678666937d22e0181dffdc7c1790ff2c4a4046732d8cdf352ccee60cb36
|
7
|
+
data.tar.gz: 8167bb8a446d336b4f798da86f10d66b1b67cba12f1d95f4c0a1be828d08526add3346916451f4a02226f469320c476a43ff1372a2f67384d68500e63a0553a9
|
data/lib/timber/config.rb
CHANGED
@@ -18,14 +18,28 @@ module Timber
|
|
18
18
|
|
19
19
|
include Singleton
|
20
20
|
|
21
|
-
attr_writer :append_metadata, :debug_logger, :http_body_limit, :logger
|
21
|
+
attr_writer :append_metadata, :debug_logger, :header_filters, :http_body_limit, :logger
|
22
22
|
|
23
23
|
# @private
|
24
24
|
def initialize
|
25
|
+
@header_filters = []
|
25
26
|
@http_body_limit = 2000
|
26
27
|
end
|
27
28
|
|
29
|
+
# This is useful for debugging. This Sets a debug_logger to view internal Timber library
|
30
|
+
# log messages. The default is `nil`. Meaning log to nothing.
|
31
|
+
#
|
32
|
+
# @example Rails
|
33
|
+
# config.timber.debug_logger = ::Logger.new(STDOUT)
|
34
|
+
# @example Everything else
|
35
|
+
# Timber::Config.instance.debug_logger = ::Logger.new(STDOUT)
|
36
|
+
def debug_logger
|
37
|
+
@debug_logger
|
38
|
+
end
|
39
|
+
|
28
40
|
# The environment your app is running in. Defaults to `RACK_ENV` and `RAILS_ENV`.
|
41
|
+
# It should be rare that you have to set this. If the aforementioned env vars are not
|
42
|
+
# set please do.
|
29
43
|
#
|
30
44
|
# @example Rails
|
31
45
|
# config.timber.environment = "staging"
|
@@ -35,21 +49,21 @@ module Timber
|
|
35
49
|
@environment ||= ENV["RACK_ENV"] || ENV["RAILS_ENV"] || "development"
|
36
50
|
end
|
37
51
|
|
38
|
-
#
|
39
|
-
#
|
40
|
-
# written to this logger.
|
52
|
+
# This is a list of header keys that should be filtered. Note, all headers are
|
53
|
+
# normalized to down-case. So please _only_ pass down-cased headers.
|
41
54
|
#
|
42
55
|
# @example Rails
|
43
|
-
# config.
|
44
|
-
#
|
45
|
-
|
46
|
-
|
47
|
-
@debug_logger
|
56
|
+
# # config/environments/production.rb
|
57
|
+
# config.timber.filter_headers += ['api-key']
|
58
|
+
def header_filters
|
59
|
+
@header_filters
|
48
60
|
end
|
49
61
|
|
50
62
|
# Truncates captured HTTP bodies to this specified limit. The default is `2000`.
|
51
63
|
# If you want to capture more data, you can raise this to a maximum of `5000`,
|
52
|
-
# or lower this to be more efficient with data.
|
64
|
+
# or lower this to be more efficient with data. `2000` characters should give you a good
|
65
|
+
# idea of the body content. If you need to raise to `5000` you're only constraint is
|
66
|
+
# network throughput.
|
53
67
|
#
|
54
68
|
# @example Rails
|
55
69
|
# config.timber.http_body_limit = 500
|
@@ -59,12 +73,13 @@ module Timber
|
|
59
73
|
@http_body_limit
|
60
74
|
end
|
61
75
|
|
62
|
-
#
|
63
|
-
# for production and staging environments. Other environments should be set manually.
|
64
|
-
# If set to `true` log messages will look like:
|
76
|
+
# This determines if the log messages should have metadata appended. Ex:
|
65
77
|
#
|
66
78
|
# log message @metadata {...}
|
67
79
|
#
|
80
|
+
# By default, this is turned on for production and staging environments only. Other
|
81
|
+
# environment should set this setting explicitly.
|
82
|
+
#
|
68
83
|
# @example Rails
|
69
84
|
# config.timber.append_metadata = false
|
70
85
|
# @example Everything else
|
@@ -77,10 +92,9 @@ module Timber
|
|
77
92
|
production? || staging?
|
78
93
|
end
|
79
94
|
|
80
|
-
# This is the logger Timber writes to. All of the Timber integrations write to
|
81
|
-
# this logger. It should be set to your global logger
|
82
|
-
#
|
83
|
-
# For Rails this is set automatically to `Rails.logger`.
|
95
|
+
# This is the _main_ logger Timber writes to. All of the Timber integrations write to
|
96
|
+
# this logger instance. It should be set to your global logger. For Rails, this is set
|
97
|
+
# automatically to `Rails.logger`, you should not have to set this.
|
84
98
|
#
|
85
99
|
# @example Rails
|
86
100
|
# Rails.logger = Timber::Logger.new(STDOUT)
|
@@ -31,7 +31,11 @@ module Timber
|
|
31
31
|
when AUTHORIZATION_HEADER
|
32
32
|
h[k] = SANITIZED_VALUE
|
33
33
|
else
|
34
|
-
|
34
|
+
if Config.instance.header_filters && Config.instance.header_filters.include?(k)
|
35
|
+
h[k] = SANITIZED_VALUE
|
36
|
+
else
|
37
|
+
h[k] = v
|
38
|
+
end
|
35
39
|
end
|
36
40
|
end
|
37
41
|
else
|
@@ -48,7 +52,7 @@ module Timber
|
|
48
52
|
query_string = query_string.to_s
|
49
53
|
end
|
50
54
|
|
51
|
-
query_string[0..(QUERY_STRING_LIMIT - 1)]
|
55
|
+
query_string && query_string[0..(QUERY_STRING_LIMIT - 1)]
|
52
56
|
end
|
53
57
|
end
|
54
58
|
end
|
data/lib/timber/version.rb
CHANGED
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.0.
|
4
|
+
version: 2.0.7
|
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-03-
|
11
|
+
date: 2017-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|