Sha256: 3b5d2baa1ccbca9b02eb6b3186a09b20199c2568a202184217f1315c652d1985
Contents?: true
Size: 852 Bytes
Versions: 1
Compression:
Stored size: 852 Bytes
Contents
require 'owskilog/version' require 'owskilog/event' require 'owskilog/event_manager' module OwskiLog class Holder include EventManager attr_accessor :events def initialize @events = Hash.new end def wrap(key, description, parent_key: nil, &block) ev = Event.new(key, description) register_event(@events, ev, parent_key: parent_key) block.call(key) unless ev.is_finished? finish_event(@events, key, OwskiLog::Status::OK) end rescue Exception => e finish_event(@events, key, OwskiLog::Status::ERROR, cause: e.inspect) end def get_log_structure @result = [] @events.each do |_, value| if value.parent != nil value.parent.sub_events << value else @result << value end end @result end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
owskilog-0.2.0 | lib/owskilog.rb |