httplog 0.99.5 → 0.99.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: 171ee73eefb8e79a86b7c2566df70dab6aad1357
4
- data.tar.gz: 2275f2845222aa0c012e965e46074a9df52c1253
3
+ metadata.gz: 9b453c04dfcdace524f7bb47829c2a048b2e8e46
4
+ data.tar.gz: c8ff6e4961c6e60e9be38c3a7005487632cd6e99
5
5
  SHA512:
6
- metadata.gz: 9df8231a2f5c5727f6947ef4558911d650c453b05881cd951b89006fab645d4a62aab08b0d6f5c6122a10fc6a32a7f4393993c4518b8f392eca249979736c3e2
7
- data.tar.gz: 112c64d10ac4733e8da1028745ad2b9aa404be50982e9e76aa9e02b3aeb55018c1e5feffc8207cdf3ae908bc652e13cea3ab2455dffc53c6de1e7c305cb2b131
6
+ metadata.gz: 4c480fdc9dbde685c211121c5f44eca1d206f22c2a0fa707bc6fea1d59236210b0d8a0368dd873ba6c3b98087ac40a2b863894ad069a5b61c3d61b061a0e9468
7
+ data.tar.gz: ed6491089b43e26c234f101823300eef2b46f291ed66a1cbc6f36ccf2476dd90f29c20949bac574469e129b28403bb1e54c0866804d5c3ac47e6ef47f009e351
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **+++ This is the README for version 0.99.0 and higher. If you're on previous versions, please refer to [this README version](https://github.com/trusche/httplog/tree/v0.3.3), since the configuration syntax has changed.+++**
6
6
 
7
- Log outgoing HTTP requests made from your application. Helps with debugging pesky API error responses, or just generally understanding what's going on under the hood.
7
+ Log outgoing HTTP requests made from your application. Helps with debugging pesky API error responses, or just generally understanding what's going on under the hood.
8
8
 
9
9
  **+++Requires ruby 2.2 or higher. If you're stuck with an older version of ruby for some reason, you're stuck with httplog v0.3.3.+++**
10
10
 
@@ -27,7 +27,7 @@ These libraries are at least partially supported, where they use one of the abov
27
27
  In theory, it should also work with any library built on top of these. But the difference between theory and practice is bigger in practice than in theory.
28
28
 
29
29
  This is very much a development and debugging tool; it is **not recommended** to
30
- use this in a production environment as it is moneky-patching the respective HTTP implementations.
30
+ use this in a production environment as it is moneky-patching the respective HTTP implementations.
31
31
  You have been warned - use at your own risk.
32
32
 
33
33
  ### Installation
@@ -38,11 +38,11 @@ You have been warned - use at your own risk.
38
38
 
39
39
  require 'httplog' # require this *after* your HTTP gem of choice
40
40
 
41
- By default, this will log all outgoing HTTP requests and their responses to $stdout on DEBUG level.
41
+ By default, this will log all outgoing HTTP requests and their responses to $stdout on DEBUG level.
42
42
 
43
43
  ### Notes on content types
44
44
 
45
- * Binary data from response bodies (as indicated by the `Content-Type` header)is not logged.
45
+ * Binary data from response bodies (as indicated by the `Content-Type` header)is not logged.
46
46
  * Text data (`text/*` and most `application/*` types) is encoded as UTF-8, with invalid characters replaced. If you need to inspect raw non-UTF data exactly as sent over the wire, this tool is probably not for you.
47
47
 
48
48
  ### Configuration
@@ -51,13 +51,16 @@ You can override the following default options:
51
51
 
52
52
  ```ruby
53
53
  HttpLog.configure do |config|
54
-
54
+
55
+ # Enabled or disabled logging
56
+ config.enabled = true
57
+
55
58
  # You can assign a different logger
56
59
  config.logger = Logger.new($stdout)
57
-
60
+
58
61
  # I really wouldn't change this...
59
62
  config.severity = Logger::Severity::DEBUG
60
-
63
+
61
64
  # Tweak which parts of the HTTP cycle to log...
62
65
  config.log_connect = true
63
66
  config.log_request = true
@@ -66,13 +69,13 @@ HttpLog.configure do |config|
66
69
  config.log_status = true
67
70
  config.log_response = true
68
71
  config.log_benchmark = true
69
-
72
+
70
73
  # ...or log all request as a single line by setting this to `true`
71
- config.compact_log = false
72
-
74
+ config.compact_log = false
75
+
73
76
  # Prettify the output - see below
74
77
  config.color = false
75
-
78
+
76
79
  # Limit logging based on URL patterns
77
80
  config.url_whitelist_pattern = /.*/
78
81
  config.url_blacklist_pattern = nil
@@ -1,6 +1,7 @@
1
1
  module HttpLog
2
2
  class Configuration
3
- attr_accessor :compact_log,
3
+ attr_accessor :enabled,
4
+ :compact_log,
4
5
  :logger,
5
6
  :severity,
6
7
  :prefix,
@@ -20,6 +21,7 @@ module HttpLog
20
21
  :prefix_line_numbers
21
22
 
22
23
  def initialize
24
+ @enabled = true
23
25
  @compact_log = false
24
26
  @logger = Logger.new($stdout)
25
27
  @severity = Logger::Severity::DEBUG
@@ -30,6 +30,7 @@ module HttpLog
30
30
  end
31
31
 
32
32
  def log(msg)
33
+ return unless config.enabled
33
34
  config.logger.log(config.severity, colorize(prefix + msg))
34
35
  end
35
36
 
@@ -1,3 +1,3 @@
1
1
  module HttpLog
2
- VERSION = "0.99.5"
2
+ VERSION = "0.99.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httplog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.5
4
+ version: 0.99.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thilo Rusche
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-05 00:00:00.000000000 Z
11
+ date: 2017-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec