Sha256: 5a02902398020b353ec3a52c0dcefb0303b9d8a836b2d41d5f13e720017a60ad
Contents?: true
Size: 788 Bytes
Versions: 13
Compression:
Stored size: 788 Bytes
Contents
#!/usr/bin/env ruby require 'json' require 'securerandom' $stdout.sync = true $stdin.sync = true TRACE_ID = ENV['TRACE_ID'] || SecureRandom.hex def get_object(message) object = {} object[:trace_id] = TRACE_ID object[:token_id] = SecureRandom.hex object[:message] = message object[:timestamp] = Time.now.to_f object end def print_marker(marker) object = get_object('ix log initiation marker') puts JSON.dump(object) end print_markers = true if ARGV[0] print_markers = false end if print_markers object = get_object('ix log initiation marker') puts JSON.dump(object) end STDIN.each_line do |line| object = get_object(line.chomp!) puts JSON.dump(object) end if print_markers object = get_object('ix log termination marker') puts JSON.dump(object) end
Version data entries
13 entries across 13 versions & 1 rubygems