loggability 0.16.0 → 0.17.0

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
  SHA256:
3
- metadata.gz: '08efe977f97d6ff78421b1ff180716378aa56afb83b0aac80cf36550f4509e00'
4
- data.tar.gz: 1af9769dad5f2eca223b413f1ead75dcbe2e322dc96f4d9598d3f275d3fa661a
3
+ metadata.gz: 657ddfb25b87eccec0c814690fcc32056a5f0864d8e662f313b50a98cc44342e
4
+ data.tar.gz: 0653afb117c71ef19153a1f4f2440436ad427c6b74c64d1d7d1d0edb2cde5b0b
5
5
  SHA512:
6
- metadata.gz: 9fd3be386367fab5fbf7b1afba29e234f452160af4514098880483d6d4c377bc201c4558aad2e1e19e8ddbd2c24afbef34cf25fe6047a7fbaa2a08c742141de5
7
- data.tar.gz: e96d9bd362d3709c3035938e03fa303c635846c1722a270b2d9286c0736c46d103f00d05f5391ad96b3dbcbcc5c3f5262378e62a38ac704ccaddc53dc9644089
6
+ metadata.gz: 10c6bc903e01021b38fcdabe55081e09c693ce54ebe388aef44752a17fec3e4e86a34d1bc40e7ae4c634f3d2a2ebf8c1be8e1813bdf9236b6eb29a6b5d50405e
7
+ data.tar.gz: 642857455ee0f09e90278308c9fe3da3c19e07dbe0e9a9a4ad30671075d71bfdc292a23df2dc2cc2a2c22f0cc452283216f14beac16deb4fe8ee76a95938df80
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,6 +1,19 @@
1
1
  = Release History for loggability
2
2
 
3
3
  ---
4
+
5
+ == v0.17.0 [2020-02-27] Michael Granger <ged@faeriemud.org>
6
+
7
+ Bugfixes:
8
+
9
+ - Fix the construction of the client in the http log device
10
+
11
+ Improvements:
12
+
13
+ - Add support for log devices to the aggregate #output_to
14
+
15
+
16
+
4
17
  == v0.16.0 [2020-02-24] Michael Granger <ged@faeriemud.org>
5
18
 
6
19
  Improvements:
@@ -9,7 +9,7 @@ require 'date'
9
9
  module Loggability
10
10
 
11
11
  # Package version constant
12
- VERSION = '0.16.0'
12
+ VERSION = '0.17.0'
13
13
 
14
14
  # The key for the global logger (Loggability's own logger)
15
15
  GLOBAL_KEY = :__global__
@@ -146,12 +146,12 @@ module Loggability
146
146
 
147
147
  ### Call the method with the given +methodname+ across the loggers of all loghosts with
148
148
  ### the given +arg+ and/or +block+.
149
- def self::aggregate( methodname, arg, &block )
149
+ def self::aggregate( methodname, *args, &block )
150
150
  # self.log.debug "Aggregating a call to %p with %p to %d log hosts" %
151
151
  # [ methodname, arg, Loggability.log_hosts.length ]
152
152
  Loggability.log_hosts.values.each do |loghost|
153
153
  # self.log.debug " %p.logger.%s( %p )" % [ loghost, methodname, arg ]
154
- loghost.logger.send( methodname, arg, &block )
154
+ loghost.logger.send( methodname, *args, &block )
155
155
  end
156
156
  end
157
157
 
@@ -191,8 +191,8 @@ module Loggability
191
191
  #
192
192
  # Aggregate method: set all loggers to log to +destination+. See Loggability::Logger#output_to
193
193
  # for more info.
194
- def self::output_to( newdevice )
195
- self.aggregate( :output_to, newdevice )
194
+ def self::output_to( newdevice, *args )
195
+ self.aggregate( :output_to, newdevice, *args )
196
196
  end
197
197
  class << self
198
198
  alias_method :write_to, :output_to
@@ -269,7 +269,7 @@ class Loggability::LogDevice::Http < Loggability::LogDevice
269
269
  ### sets up a configured http object ready to instantiate connections
270
270
  def http_client
271
271
  return @http_client ||= begin
272
- uri = URI.parse( self.endpoint )
272
+ uri = URI( self.endpoint )
273
273
 
274
274
  http = Net::HTTP.new( uri.host, uri.port )
275
275
  http.write_timeout = self.write_timeout
@@ -145,4 +145,25 @@ describe Loggability::LogDevice::Http do
145
145
  end
146
146
 
147
147
 
148
+ it "uses an HTTP client for the appropriate host and port" do
149
+ device = described_class.new(
150
+ 'http://logs.example.com:12881/v1/log_ingester',
151
+ executor_class: Concurrent::ImmediateExecutor )
152
+ http = device.http_client
153
+
154
+ expect( http.address ).to eq( 'logs.example.com' )
155
+ expect( http.port ).to eq( 12881 )
156
+ end
157
+
158
+
159
+ it "verifies the peer cert if sending to an HTTPS endpoint" do
160
+ device = described_class.new(
161
+ 'https://logs.example.com:12881/v1/log_ingester',
162
+ executor_class: Concurrent::ImmediateExecutor )
163
+ http = device.http_client
164
+
165
+ expect( http.use_ssl? ).to be_truthy
166
+ expect( http.verify_mode ).to eq( OpenSSL::SSL::VERIFY_PEER )
167
+ end
168
+
148
169
  end
@@ -161,6 +161,12 @@ describe Loggability do
161
161
  expect( Loggability[loghost].logdev.dev ).to be( $stdout )
162
162
  end
163
163
 
164
+ it "can propagate an outputter with arguments to every loghost" do
165
+ Loggability.output_to( :http, 'http://localhost:12771/v1/logs' )
166
+ expect( Loggability[loghost].logdev ).to be_a( Loggability::LogDevice )
167
+ expect( Loggability[loghost].logdev.endpoint ).to eq( URI('http://localhost:12771/v1/logs') )
168
+ end
169
+
164
170
  it "can propagate a formatter to every loghost" do
165
171
  Loggability.format_with( :color )
166
172
  expect( Loggability[loghost].formatter ).to be_a( Loggability::Formatter::Color )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loggability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -34,7 +34,7 @@ cert_chain:
34
34
  jBZSA+N+xUTgUWpXjjwsLZjzJkhWATJWq+krNXcqpwXo6HsjmdUxoFMt63RBb+sI
35
35
  XrxOxp8o0uOkU7FdLSGsyqJ2LzsR4obN
36
36
  -----END CERTIFICATE-----
37
- date: 2020-02-24 00:00:00.000000000 Z
37
+ date: 2020-02-27 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: rake-deveiate
metadata.gz.sig CHANGED
Binary file