Skip to content

Commit

Permalink
(maint) Use the PCP::SimpleLogger in the client
Browse files Browse the repository at this point in the history
By using PCP::SimpleLogger the later .inspect of the failed
client state will include the logged lines about why it failed to
connect, something like:

    <PCP::Client:0x007fc8b52defd0
    @logger=#<PCP::SimpleLogger:0x007fc8b52df0e8
        @events=[
           {:when=>1455722334.0191228, :severity=>0, :message=>[:connect, "wss://localhost:8142/pcp"]},
           {:when=>1455722334.019747, :severity=>1, :message=>[:close, 1006, ""]}], @Level=0>
     ...>
  • Loading branch information
richardc committed Feb 17, 2016
1 parent 7041287 commit 7b02c91
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions acceptance/lib/pxp-agent/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'pxp-agent/config_helper.rb'
require 'pcp/client'
require 'pcp/simple_logger'
require 'net/http'
require 'openssl'
require 'json'
Expand Down Expand Up @@ -285,6 +286,7 @@ def connect_pcp_client(broker)
:server => broker_ws_uri(broker),
:ssl_cert => "../test-resources/ssl/certs/controller01.example.com.pem",
:ssl_key => "../test-resources/ssl/private_keys/controller01.example.com.pem",
:logger => PCP::SimpleLogger.new,
:loglevel => logger.is_debug? ? Logger::DEBUG : Logger::WARN
})
connected = client.connect(5)
Expand Down

0 comments on commit 7b02c91

Please sign in to comment.