Module: TezosClient::Logger
- Extended by:
- ActiveSupport::Concern
- Included in:
- TezosClient, OperationFailure, RpcInterface, SmartpyInterface
- Defined in:
- lib/tezos_client/logger.rb
Constant Summary collapse
- FILTERED_KEYS =
[:code, :contractCode]
- @@logger =
nil
- @@env_logger =
nil
Instance Method Summary collapse
- #log(out) ⇒ Object
- #tezos_contents_log(content) ⇒ Object
- #tezos_contents_log_filter(content) ⇒ Object
Instance Method Details
#log(out) ⇒ Object
11 12 13 14 |
# File 'lib/tezos_client/logger.rb', line 11 def log(out) return unless self.class.logger self.class.logger << out + "\n" end |
#tezos_contents_log(content) ⇒ Object
34 35 36 |
# File 'lib/tezos_client/logger.rb', line 34 def tezos_contents_log(content) tezos_contents_log_filter(content).pretty_inspect end |
#tezos_contents_log_filter(content) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tezos_client/logger.rb', line 17 def tezos_contents_log_filter(content) if content.is_a? Array content.map { |el| tezos_contents_log_filter(el) } elsif content.is_a? Hash content.reduce({}) do |h, (k, v)| value = if FILTERED_KEYS.include? k.to_sym "#{v.to_s[0..30]}..." else tezos_contents_log_filter(v) end h.merge(k => value) end else content end end |