lib/clogger/pure.rb in clogger-1.0.1 vs lib/clogger/pure.rb in clogger-1.1.0
- old
+ new
@@ -96,11 +96,13 @@
private
def byte_xs(s)
s = s.dup
s.force_encoding(Encoding::BINARY) if defined?(Encoding::BINARY)
- s.gsub!(/(['"\x00-\x1f])/) { |x| "\\x#{$1.unpack('H2').first.upcase}" }
+ s.gsub!(/(['"\x00-\x1f\x7f-\xff])/) do |x|
+ "\\x#{$1.unpack('H2').first.upcase}"
+ end
s
end
SPECIAL_RMAP = SPECIAL_VARS.inject([]) { |ary, (k,v)| ary[v] = k; ary }
@@ -173,10 +175,10 @@
time_format(t.to_i, (t - t.to_i) * 1000000, op[1], op[2])
when OP_TIME
t = Time.now
time_format(t.to_i, t.usec, op[1], op[2])
when OP_COOKIE
- (env['rack.request.cookie_hash'][op[1]] rescue "-") || "-"
+ (byte_xs(env['rack.request.cookie_hash'][op[1]]) rescue "-") || "-"
else
raise "EDOOFUS #{op.inspect}"
end
}.join('')
end