httplog 1.1.0 → 1.1.1

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: a1a6bb62cffc8f365f925d280097d835de32fa39
4
- data.tar.gz: a53f43593858933638a3bb12de772d4ed839edc6
3
+ metadata.gz: d14cf469bd22766290911769c43b063cedd6fb99
4
+ data.tar.gz: 2841bc515ff5a8ba0bc93c7cce4e32890c4e6dcb
5
5
  SHA512:
6
- metadata.gz: 69ab458de0d89d1e2ee4c8e505adc1e969623455a83b27faeaeed59d194fa6fe09d09ab96fb7187accc4433f16682b4ef0e222080ff0fa5088f46e2bff6c33ae
7
- data.tar.gz: 9602b2e29793e1d0cb358e59d0a105ed910a6e1de3b2f8f5e1f4aa3fd49cd2fc39fff5b76c521c581482e54aab354c644cd01f53210ed7b96240edc17608bfd4
6
+ metadata.gz: 4e8a1a683566e66ebb9ba3541e0e3920c8c4cb72840db8de88e27099775bf4c0d434899bee602a01e089d20f8a12541a5431db52b68623efe1fcc5c0cf84397c
7
+ data.tar.gz: 112ff2e0279fb85b20f705976c6f2314115a75ea8be82d492e51a13db926e038cfe14a4d65caa0da42f96d42e26db2f5291c4065a76d0dd7edc8e70bdb0fc4c7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- httplog (1.1.0)
4
+ httplog (1.1.1)
5
5
  rack (>= 1.0)
6
6
  rainbow (>= 2.0.0)
7
7
 
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  ## httplog
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/httplog.svg)](http://badge.fury.io/rb/httplog) [![Build Status](https://travis-ci.org/trusche/httplog.svg?branch=master)](https://travis-ci.org/trusche/httplog) [![Code Climate](https://codeclimate.com/github/trusche/httplog.svg)](https://codeclimate.com/github/trusche/httplog)
4
+ [![Release Version](https://img.shields.io/github/release/trusche/httplog.svg)](https://img.shields.io/github/release/trusche/httplog.svg)
4
5
 
5
6
  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.
6
7
 
@@ -90,7 +91,16 @@ HttpLog.configure do |config|
90
91
  end
91
92
  ```
92
93
 
93
- You can colorize the output to make it stand out in your logfile:
94
+ You can colorize the output to make it stand out in your logfile, either with a single color
95
+ for the text:
96
+
97
+ ```ruby
98
+ HttpLog.configure do |config|
99
+ config.color = :red
100
+ end
101
+ ```
102
+
103
+ Or with a color hash for text and background:
94
104
 
95
105
  ```ruby
96
106
  HttpLog.configure do |config|
@@ -119,7 +119,13 @@ module HttpLog
119
119
 
120
120
  def colorize(msg)
121
121
  return msg unless config.color
122
- Rainbow(msg).send(config.color)
122
+ if config.color.is_a?(Hash)
123
+ msg = Rainbow(msg).color(config.color[:color]) if config.color[:color]
124
+ msg = Rainbow(msg).bg(config.color[:background]) if config.color[:background]
125
+ else
126
+ msg = Rainbow(msg).color(config.color)
127
+ end
128
+ msg
123
129
  rescue
124
130
  warn "HTTPLOG CONFIGURATION ERROR: #{config.color} is not a valid color"
125
131
  msg
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HttpLog
4
- VERSION = '1.1.0'.freeze
4
+ VERSION = '1.1.1'.freeze
5
5
  end
@@ -201,10 +201,16 @@ describe HttpLog do
201
201
  expect(log).to_not include(HttpLog::LOG_PREFIX + 'Data:')
202
202
  end
203
203
 
204
- it 'should colorized output' do
204
+ it 'should colorized output with single color' do
205
205
  HttpLog.configure { |c| c.color = :red }
206
206
  adapter.send_get_request
207
- expect(log).to include("\e[0")
207
+ expect(log).to include("\e[31m")
208
+ end
209
+
210
+ it 'should colorized output with color hash' do
211
+ HttpLog.configure { |c| c.color = { color: :black, background: :yellow } }
212
+ adapter.send_get_request
213
+ expect(log).to include("\e[30m\e[43m")
208
214
  end
209
215
 
210
216
  it 'should log with custom string prefix' do
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: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thilo Rusche
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-22 00:00:00.000000000 Z
11
+ date: 2018-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ethon