Class: BitcoinNode::P2p::LoggingProbe
- Inherits:
-
Object
- Object
- BitcoinNode::P2p::LoggingProbe
- Defined in:
- lib/bitcoin_node/p2p/probe.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #<<(hash) ⇒ Object
-
#initialize(progname) ⇒ LoggingProbe
constructor
A new instance of LoggingProbe.
Constructor Details
#initialize(progname) ⇒ LoggingProbe
Returns a new instance of LoggingProbe.
24 25 26 27 |
# File 'lib/bitcoin_node/p2p/probe.rb', line 24 def initialize(progname) @logger = ::Logger.new(STDOUT) @logger.progname = progname.upcase end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
22 23 24 |
# File 'lib/bitcoin_node/p2p/probe.rb', line 22 def logger @logger end |
Instance Method Details
#<<(hash) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bitcoin_node/p2p/probe.rb', line 29 def <<(hash) hash.each do |key, value| case key when :sending then logger.info("Sending #{value}") when :receiving then logger.info("Receiving #{value}") when :connected then logger.info("Connected to #{value}") when :connection then logger.info("Connection received from #{value}") when :closed then logger.info("Closed connection to #{value}") else logger.unknown('Cannot log that!!') end end end |