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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +11 -1
- data/lib/httplog/http_log.rb +7 -1
- data/lib/httplog/version.rb +1 -1
- data/spec/lib/http_log_spec.rb +8 -2
- 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: d14cf469bd22766290911769c43b063cedd6fb99
         | 
| 4 | 
            +
              data.tar.gz: 2841bc515ff5a8ba0bc93c7cce4e32890c4e6dcb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4e8a1a683566e66ebb9ba3541e0e3920c8c4cb72840db8de88e27099775bf4c0d434899bee602a01e089d20f8a12541a5431db52b68623efe1fcc5c0cf84397c
         | 
| 7 | 
            +
              data.tar.gz: 112ff2e0279fb85b20f705976c6f2314115a75ea8be82d492e51a13db926e038cfe14a4d65caa0da42f96d42e26db2f5291c4065a76d0dd7edc8e70bdb0fc4c7
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            ## httplog
         | 
| 2 2 |  | 
| 3 3 | 
             
            [](http://badge.fury.io/rb/httplog) [](https://travis-ci.org/trusche/httplog) [](https://codeclimate.com/github/trusche/httplog)
         | 
| 4 | 
            +
            [](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|
         | 
    
        data/lib/httplog/http_log.rb
    CHANGED
    
    | @@ -119,7 +119,13 @@ module HttpLog | |
| 119 119 |  | 
| 120 120 | 
             
                def colorize(msg)
         | 
| 121 121 | 
             
                  return msg unless config.color
         | 
| 122 | 
            -
                   | 
| 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
         | 
    
        data/lib/httplog/version.rb
    CHANGED
    
    
    
        data/spec/lib/http_log_spec.rb
    CHANGED
    
    | @@ -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[ | 
| 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. | 
| 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- | 
| 11 | 
            +
            date: 2018-07-30 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: ethon
         |