faraday-detailed_logger 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb352eb399f4ac57d1071035fdc203dda0355739
4
- data.tar.gz: b6a9027c5057ab56935227e4560e23fa12a1d001
3
+ metadata.gz: f65fb1d360770fe4d51b99bedae9016ea6789e3f
4
+ data.tar.gz: 954feca443ded3f589ed95bd159bfe05b0929805
5
5
  SHA512:
6
- metadata.gz: 7fc4499e022106b8c9556b308386c716cff7b3b431ab0a8ed4eac8ef93b1f05e0b92709810611d9dcd9055579cc4778611bbae80dd9e4187bb605ab941533893
7
- data.tar.gz: 999315254ac8c92728d28eb6030b2e391aa4c4b864fc0e208c2f617316269cc65de7c4a3e6e30857beedb0c1806b270cea7822ec71af28a68224b4d014b6d0b6
6
+ metadata.gz: 1d32d134b03fb3b79d105074c5364af2fef9d767bc1c93e77b1102a41b64906a363693a5352ba5d486ca295687645dc767b377448bba8110694bfbee2b8d5187
7
+ data.tar.gz: 9ecee005b15f03ea1be473d782b7948ec6417ce382a6c8a6603825880e8d0b79f9dfa10c4719f7cec0c7f9a3814f44183522bad199946b23abaec3734bac0656
data/.gitignore CHANGED
@@ -8,6 +8,9 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
 
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
11
14
  /.ruby-gemset
12
15
  /.ruby-version
13
16
  /gemfiles/*.gemfile.lock
@@ -1,247 +1,3 @@
1
- AllCops:
2
- Exclude:
3
- - "vendor/**/*"
4
- - "db/schema.rb"
5
- UseCache: false
6
- Style/BracesAroundHashParameters:
7
- EnforcedStyle: braces
8
- Style/CollectionMethods:
9
- Description: Preferred collection methods.
10
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
11
- Enabled: true
12
- PreferredMethods:
13
- collect: map
14
- collect!: map!
15
- find: detect
16
- find_all: select
17
- reduce: inject
18
- Style/DotPosition:
19
- Description: Checks the position of the dot in multi-line method calls.
20
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
21
- Enabled: true
22
- EnforcedStyle: trailing
23
- SupportedStyles:
24
- - leading
25
- - trailing
26
- Style/FileName:
27
- Description: Use snake_case for source file names.
28
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
29
- Enabled: false
30
- Exclude: []
31
- Style/GuardClause:
32
- Description: Check for conditionals that can be replaced with guard clauses
33
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
34
- Enabled: false
35
- MinBodyLength: 1
36
- Style/IfUnlessModifier:
37
- Description: Favor modifier if/unless usage when you have a single-line body.
38
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
39
- Enabled: false
40
- MaxLineLength: 80
41
- Style/IndentHash:
42
- EnforcedStyle: consistent
43
- Style/OptionHash:
44
- Description: Don't use option hashes when you can use keyword arguments.
45
- Enabled: false
46
- Style/PercentLiteralDelimiters:
47
- Description: Use `%`-literal delimiters consistently
48
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
49
- Enabled: false
50
- PreferredDelimiters:
51
- "%": "()"
52
- "%i": "()"
53
- "%q": "()"
54
- "%Q": "()"
55
- "%r": "{}"
56
- "%s": "()"
57
- "%w": "()"
58
- "%W": "()"
59
- "%x": "()"
60
- Style/PredicateName:
61
- Description: Check the names of predicate methods.
62
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
63
- Enabled: true
64
- NamePrefix:
65
- - is_
66
- - has_
67
- - have_
68
- NamePrefixBlacklist:
69
- - is_
70
- Exclude:
71
- - spec/**/*
72
- Style/RaiseArgs:
73
- Description: Checks the arguments passed to raise/fail.
74
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
75
- Enabled: false
76
- EnforcedStyle: exploded
77
- SupportedStyles:
78
- - compact
79
- - exploded
80
- Style/SignalException:
81
- Description: Checks for proper usage of fail and raise.
82
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
83
- Enabled: false
84
- EnforcedStyle: semantic
85
- SupportedStyles:
86
- - only_raise
87
- - only_fail
88
- - semantic
89
- Style/SingleLineBlockParams:
90
- Description: Enforces the names of some block params.
91
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
92
- Enabled: false
93
- Methods:
94
- - reduce:
95
- - a
96
- - e
97
- - inject:
98
- - a
99
- - e
100
- Style/SingleLineMethods:
101
- Description: Avoid single-line methods.
102
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
103
- Enabled: false
104
- AllowIfMethodIsEmpty: true
105
- Style/StringLiterals:
106
- Description: Checks if uses of quotes match the configured preference.
107
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
108
- Enabled: true
109
- EnforcedStyle: double_quotes
110
- SupportedStyles:
111
- - single_quotes
112
- - double_quotes
113
- Style/StringLiteralsInInterpolation:
114
- Description: Checks if uses of quotes inside expressions in interpolated strings
115
- match the configured preference.
116
- Enabled: true
117
- EnforcedStyle: single_quotes
118
- SupportedStyles:
119
- - single_quotes
120
- - double_quotes
121
- Style/TrailingCommaInArguments:
122
- Description: 'Checks for trailing comma in argument lists.'
123
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
124
- Enabled: false
125
- EnforcedStyleForMultiline: no_comma
126
- SupportedStyles:
127
- - comma
128
- - consistent_comma
129
- - no_comma
130
- Style/TrailingCommaInLiteral:
131
- Description: 'Checks for trailing comma in array and hash literals.'
132
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
133
- Enabled: false
134
- EnforcedStyleForMultiline: no_comma
135
- SupportedStyles:
136
- - comma
137
- - consistent_comma
138
- - no_comma
139
- Metrics/AbcSize:
140
- Description: A calculated magnitude based on number of assignments, branches, and
141
- conditions.
142
- Enabled: false
143
- Max: 15
144
- Metrics/ClassLength:
145
- Description: Avoid classes longer than 100 lines of code.
146
- Enabled: false
147
- CountComments: false
148
- Max: 100
149
- Metrics/ModuleLength:
150
- CountComments: false
151
- Max: 100
152
- Description: Avoid modules longer than 100 lines of code.
153
- Enabled: false
154
- Metrics/CyclomaticComplexity:
155
- Description: A complexity metric that is strongly correlated to the number of test
156
- cases needed to validate a method.
157
- Enabled: false
158
- Max: 6
159
- Metrics/MethodLength:
160
- Description: Avoid methods longer than 10 lines of code.
161
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
162
- Enabled: false
163
- CountComments: false
164
- Max: 10
165
- Metrics/ParameterLists:
166
- Description: Avoid parameter lists longer than three or four parameters.
167
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
168
- Enabled: false
169
- Max: 5
170
- CountKeywordArgs: true
171
- Metrics/PerceivedComplexity:
172
- Description: A complexity metric geared towards measuring complexity for a human
173
- reader.
174
- Enabled: false
175
- Max: 7
176
- Lint/AssignmentInCondition:
177
- Description: Don't use assignment in conditions.
178
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
179
- Enabled: false
180
- AllowSafeAssignment: true
181
- Style/InlineComment:
182
- Description: Avoid inline comments.
183
- Enabled: false
184
- Style/AccessorMethodName:
185
- Description: Check the naming of accessor methods for get_/set_.
186
- Enabled: false
187
- Style/Alias:
188
- Description: Use alias_method instead of alias.
189
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
190
- Enabled: false
191
- Style/Documentation:
192
- Description: Document classes and non-namespace modules.
193
- Enabled: false
194
- Style/DoubleNegation:
195
- Description: Checks for uses of double negation (!!).
196
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
197
- Enabled: false
198
- Style/EachWithObject:
199
- Description: Prefer `each_with_object` over `inject` or `reduce`.
200
- Enabled: false
201
- Style/EmptyLiteral:
202
- Description: Prefer literals to Array.new/Hash.new/String.new.
203
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
204
- Enabled: false
205
- Style/ModuleFunction:
206
- Description: Checks for usage of `extend self` in modules.
207
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
208
- Enabled: false
209
- Style/OneLineConditional:
210
- Description: Favor the ternary operator(?:) over if/then/else/end constructs.
211
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
212
- Enabled: false
213
- Style/PerlBackrefs:
214
- Description: Avoid Perl-style regex back references.
215
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
216
- Enabled: false
217
- Style/Send:
218
- Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
219
- may overlap with existing methods.
220
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
221
- Enabled: false
222
- Style/SpecialGlobalVars:
223
- Description: Avoid Perl-style global variables.
224
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
225
- Enabled: false
226
- Style/VariableInterpolation:
227
- Description: Don't interpolate global, instance and class variables directly in
228
- strings.
229
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
230
- Enabled: false
231
- Style/WhenThen:
232
- Description: Use when x then ... for one-line cases.
233
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
234
- Enabled: false
235
- Lint/EachWithObjectArgument:
236
- Description: Check for immutable argument given to each_with_object.
237
- Enabled: true
238
- Lint/HandleExceptions:
239
- Description: Don't suppress exception.
240
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
241
- Enabled: false
242
- Lint/LiteralInCondition:
243
- Description: Checks of literals used in conditions.
244
- Enabled: false
245
- Lint/LiteralInInterpolation:
246
- Description: Checks for literals used in interpolation.
247
- Enabled: false
1
+ inherit_gem:
2
+ rubocop-rails:
3
+ - config/rails.yml
@@ -1,20 +1,22 @@
1
- before_install: gem install bundler -v 1.12.5
1
+ before_install: gem install bundler -v 1.15.4
2
2
  cache: bundler
3
3
  gemfile:
4
4
  - gemfiles/faraday_0.8.gemfile
5
5
  - gemfiles/faraday_0.9.gemfile
6
6
  - gemfiles/faraday_0.10.gemfile
7
+ - gemfiles/faraday_0.11.gemfile
8
+ - gemfiles/faraday_0.12.gemfile
9
+ - gemfiles/faraday_0.13.gemfile
7
10
  - gemfiles/faraday_canary.gemfile
8
11
  language: ruby
9
12
  matrix:
10
- fast_finish: true
11
13
  allow_failures:
12
14
  - gemfile: gemfiles/faraday_canary.gemfile
15
+ fast_finish: true
13
16
  notifications:
14
17
  email: false
15
18
  rvm:
16
- - 2.1.10
17
- - 2.2.6
18
- - 2.3.3
19
- - 2.4.0
19
+ - 2.2.7
20
+ - 2.3.4
21
+ - 2.4.1
20
22
  sudo: false
data/Appraisals CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  appraise "faraday-0.8" do
2
4
  gem "faraday", "~> 0.8.0"
3
5
  end
@@ -10,6 +12,18 @@ appraise "faraday-0.10" do
10
12
  gem "faraday", "~> 0.10.0"
11
13
  end
12
14
 
15
+ appraise "faraday-0.11" do
16
+ gem "faraday", "~> 0.11.0"
17
+ end
18
+
19
+ appraise "faraday-0.12" do
20
+ gem "faraday", "~> 0.12.0"
21
+ end
22
+
23
+ appraise "faraday-0.13" do
24
+ gem "faraday", "~> 0.13.0"
25
+ end
26
+
13
27
  appraise "faraday-canary" do
14
- gem "faraday", github: "lostisland/faraday"
28
+ gem "faraday", git: "https://github.com/lostisland/faraday.git"
15
29
  end
@@ -1,15 +1,22 @@
1
1
  # Faraday::DetailedLogger changelog
2
2
 
3
- [![Gem Version](https://img.shields.io/gem/v/faraday-detailed_logger.svg)](http://rubygems.org/gems/faraday-detailed_logger)
3
+ [![Gem Version](https://img.shields.io/gem/v/faraday-detailed_logger.svg)](https://rubygems.org/gems/faraday-detailed_logger)
4
4
  [![Build Status](https://img.shields.io/travis/envylabs/faraday-detailed_logger/master.svg)](https://travis-ci.org/envylabs/faraday-detailed_logger)
5
5
  [![Code Climate](https://img.shields.io/codeclimate/github/envylabs/faraday-detailed_logger.svg)](https://codeclimate.com/github/envylabs/faraday-detailed_logger)
6
6
  [![Coverage Status](https://img.shields.io/coveralls/envylabs/faraday-detailed_logger.svg)](https://coveralls.io/r/envylabs/faraday-detailed_logger)
7
7
  [![Dependency Status](https://gemnasium.com/envylabs/faraday-detailed_logger.svg)](https://gemnasium.com/envylabs/faraday-detailed_logger)
8
+ [![Inline docs](https://inch-ci.org/github/envylabs/faraday-detailed_logger.svg?branch=master)](https://inch-ci.org/github/envylabs/faraday-detailed_logger)
8
9
 
9
10
  ## [HEAD][] / unreleased
10
11
 
11
12
  * No significant changes.
12
13
 
14
+ ## [2.1.2][] / 2016-08-21
15
+
16
+ * Update the middleware to allow the `logger` and `tags` to be publicly
17
+ accessible. This is not necessarily intended to be developer-used, but rather
18
+ fix warnings in older versions of Ruby.
19
+
13
20
  ## [2.1.1][] / 2016-01-07
14
21
 
15
22
  * Require faraday `~> 0.8`. This change only makes explicit the minimum version
@@ -44,4 +51,5 @@
44
51
  [2.0.0]: https://github.com/envylabs/faraday-detailed_logger/compare/v1.1.0...v2.0.0
45
52
  [2.1.0]: https://github.com/envylabs/faraday-detailed_logger/compare/v2.0.0...v2.1.0
46
53
  [2.1.1]: https://github.com/envylabs/faraday-detailed_logger/compare/v2.1.0...v2.1.1
47
- [HEAD]: https://github.com/envylabs/faraday-detailed_logger/compare/v2.1.1...master
54
+ [2.1.2]: https://github.com/envylabs/faraday-detailed_logger/compare/v2.1.1...v2.1.2
55
+ [HEAD]: https://github.com/envylabs/faraday-detailed_logger/compare/v2.1.2...master
data/Gemfile CHANGED
@@ -1,2 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
2
7
  gemspec
data/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # Faraday::DetailedLogger
2
2
 
3
- [![Gem Version](https://img.shields.io/gem/v/faraday-detailed_logger.svg)](http://rubygems.org/gems/faraday-detailed_logger)
3
+ [![Gem Version](https://img.shields.io/gem/v/faraday-detailed_logger.svg)](https://rubygems.org/gems/faraday-detailed_logger)
4
4
  [![Build Status](https://img.shields.io/travis/envylabs/faraday-detailed_logger/master.svg)](https://travis-ci.org/envylabs/faraday-detailed_logger)
5
5
  [![Code Climate](https://img.shields.io/codeclimate/github/envylabs/faraday-detailed_logger.svg)](https://codeclimate.com/github/envylabs/faraday-detailed_logger)
6
6
  [![Coverage Status](https://img.shields.io/coveralls/envylabs/faraday-detailed_logger.svg)](https://coveralls.io/r/envylabs/faraday-detailed_logger)
7
7
  [![Dependency Status](https://gemnasium.com/envylabs/faraday-detailed_logger.svg)](https://gemnasium.com/envylabs/faraday-detailed_logger)
8
+ [![Inline docs](https://inch-ci.org/github/envylabs/faraday-detailed_logger.svg?branch=master)](https://inch-ci.org/github/envylabs/faraday-detailed_logger)
8
9
 
9
10
  A Faraday middleware used for providing debug- and info-level logging
10
11
  information. The request and response logs follow very closely with cURL output
@@ -47,6 +48,9 @@ Once required, the logger can be added to any Faraday connection by inserting
47
48
  it into your connection's request/response stack:
48
49
 
49
50
  ```ruby
51
+ require 'faraday'
52
+ require 'faraday/detailed_logger'
53
+
50
54
  connection = Faraday.new(:url => "http://sushi.com") do |faraday|
51
55
  faraday.request :url_encoded
52
56
  faraday.response :detailed_logger # <-- Inserts the logger into the connection.
@@ -59,6 +63,10 @@ desired log location, simply provide any Logger-compatible object as a
59
63
  parameter to the middleware definition:
60
64
 
61
65
  ```ruby
66
+ require 'faraday'
67
+ require 'faraday/detailed_logger'
68
+ require 'logger'
69
+
62
70
  my_logger = Logger.new("logfile.log")
63
71
  my_logger.level = Logger::INFO
64
72
 
@@ -149,7 +157,6 @@ headers and body are logged at a DEBUG level.
149
157
 
150
158
  Bug reports and pull requests are welcome on GitHub at https://github.com/envylabs/faraday-detailed_logger.
151
159
 
152
-
153
160
  ## License
154
161
 
155
162
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rspec/core/rake_task"
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task({ default: :spec })
8
+ task(default: :spec)
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "faraday/detailed_logger"
@@ -11,4 +12,4 @@ require "faraday/detailed_logger"
11
12
  # Pry.start
12
13
 
13
14
  require "irb"
14
- IRB.start
15
+ IRB.start(__FILE__)
@@ -1,4 +1,6 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  lib = File.expand_path("../lib", __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require "faraday/detailed_logger/version"
@@ -28,8 +30,9 @@ Gem::Specification.new do |spec|
28
30
  spec.add_runtime_dependency "faraday", "~> 0.8"
29
31
 
30
32
  spec.add_development_dependency "appraisal", "~> 2.0"
31
- spec.add_development_dependency "bundler", "~> 1.12"
33
+ spec.add_development_dependency "bundler", "~> 1.15"
32
34
  spec.add_development_dependency "coveralls"
33
35
  spec.add_development_dependency "rake", "~> 12.0"
34
36
  spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_development_dependency "rubocop-rails", "~> 1.0"
35
38
  end
@@ -4,4 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "faraday", "~> 0.10.0"
6
6
 
7
- gemspec :path => "../"
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "~> 0.11.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "~> 0.12.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "~> 0.13.0"
6
+
7
+ gemspec path: "../"
@@ -4,4 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "faraday", "~> 0.8.0"
6
6
 
7
- gemspec :path => "../"
7
+ gemspec path: "../"
@@ -4,4 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "faraday", "~> 0.9.0"
6
6
 
7
- gemspec :path => "../"
7
+ gemspec path: "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "faraday", :github => "lostisland/faraday"
5
+ gem "faraday", git: "https://github.com/lostisland/faraday.git"
6
6
 
7
- gemspec :path => "../"
7
+ gemspec path: "../"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "faraday/detailed_logger/version"
2
4
  require "faraday/detailed_logger/middleware"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "faraday"
2
4
  require "faraday/detailed_logger/tagged_logging"
3
5
 
@@ -14,6 +16,14 @@ module Faraday
14
16
  # greater level, this is not a concern.
15
17
  #
16
18
  class Middleware < Faraday::Response::Middleware
19
+ attr_reader :logger
20
+ attr_reader :tags
21
+
22
+ # Internal: Used as the Middleware's logger in the case that an explicit
23
+ # logger is not provided.
24
+ #
25
+ # Returns a Logger instance.
26
+ #
17
27
  def self.default_logger
18
28
  require "logger"
19
29
  ::Logger.new($stdout)
@@ -48,7 +58,9 @@ module Faraday
48
58
  end
49
59
  super
50
60
  rescue
51
- logger.error { "#{$!.class.name} - #{$!.message} (#{$!.backtrace.first})" }
61
+ logger.error do
62
+ "#{$!.class.name} - #{$!.message} (#{$!.backtrace.first})"
63
+ end
52
64
  raise
53
65
  end
54
66
 
@@ -70,34 +82,29 @@ module Faraday
70
82
 
71
83
  private
72
84
 
73
- attr_reader :logger
74
- attr_reader :tags
75
-
76
- def curl_request_output(env)
77
- curl_output(env[:request_headers], env[:body]).inspect
78
- end
85
+ def curl_request_output(env)
86
+ curl_output(env[:request_headers], env[:body]).inspect
87
+ end
79
88
 
80
- def curl_response_output(env)
81
- curl_output(env[:response_headers], env[:body]).inspect
82
- end
89
+ def curl_response_output(env)
90
+ curl_output(env[:response_headers], env[:body]).inspect
91
+ end
83
92
 
84
- def curl_output(headers, body)
85
- string = headers.map { |k, v| "#{k}: #{v}" }.join("\n")
86
- string + "\n\n#{body}"
87
- end
93
+ def curl_output(headers, body)
94
+ string = headers.map { |k, v| "#{k}: #{v}" }.join("\n")
95
+ string + "\n\n#{body}"
96
+ end
88
97
 
89
- def log_response_status(status, &block)
90
- case status
91
- when 200..399
92
- logger.info(&block)
93
- else
94
- logger.warn(&block)
98
+ def log_response_status(status, &block)
99
+ case status
100
+ when 200..399
101
+ logger.info(&block)
102
+ else
103
+ logger.warn(&block)
104
+ end
95
105
  end
96
- end
97
106
  end
98
107
  end
99
108
  end
100
109
 
101
- Faraday::Response.register_middleware({
102
- detailed_logger: Faraday::DetailedLogger::Middleware
103
- })
110
+ Faraday::Response.register_middleware(detailed_logger: Faraday::DetailedLogger::Middleware)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "logger"
2
4
 
3
5
  module Faraday
@@ -40,18 +42,18 @@ module Faraday
40
42
  end
41
43
 
42
44
  def current_tags
43
- @thread_key ||= "faraday_detailed_logger_tags:#{object_id}".freeze
45
+ @thread_key ||= "faraday_detailed_logger_tags:#{object_id}"
44
46
  Thread.current[@thread_key] ||= []
45
47
  end
46
48
 
47
49
  private
48
50
 
49
- def tags_text
50
- tags = current_tags
51
- if tags.any?
52
- tags.map { |tag| "[#{tag}] " }.join
51
+ def tags_text
52
+ tags = current_tags
53
+ if tags.any?
54
+ tags.map { |tag| "[#{tag}] " }.join
55
+ end
53
56
  end
54
- end
55
57
  end
56
58
 
57
59
  def self.new(logger)
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Faraday
2
4
  module DetailedLogger
3
- VERSION = "2.1.1".freeze
5
+ VERSION = "2.1.2"
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-detailed_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Envy Labs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-08 00:00:00.000000000 Z
11
+ date: 2017-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.12'
47
+ version: '1.15'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.12'
54
+ version: '1.15'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: coveralls
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.0'
97
111
  description: "\n A Faraday middleware for logging request and response activity
98
112
  including\n method, URI, headers, and body at varying log levels.\n "
99
113
  email:
@@ -117,6 +131,9 @@ files:
117
131
  - bin/setup
118
132
  - faraday-detailed_logger.gemspec
119
133
  - gemfiles/faraday_0.10.gemfile
134
+ - gemfiles/faraday_0.11.gemfile
135
+ - gemfiles/faraday_0.12.gemfile
136
+ - gemfiles/faraday_0.13.gemfile
120
137
  - gemfiles/faraday_0.8.gemfile
121
138
  - gemfiles/faraday_0.9.gemfile
122
139
  - gemfiles/faraday_canary.gemfile
@@ -144,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
161
  version: '0'
145
162
  requirements: []
146
163
  rubyforge_project:
147
- rubygems_version: 2.5.2
164
+ rubygems_version: 2.6.11
148
165
  signing_key:
149
166
  specification_version: 4
150
167
  summary: A detailed request and response logger for Faraday.