lib/pliny/log.rb in pliny-0.4.0 vs lib/pliny/log.rb in pliny-0.5.0
- old
+ new
@@ -8,11 +8,11 @@
def context(data, &block)
old = local_context
self.local_context = old.merge(data)
res = block.call
ensure
- local_context = old
+ self.local_context = old
res
end
def stdout=(stream)
@stdout = stream
@@ -37,15 +37,11 @@
end
def log_to_stream(stream, data, &block)
unless block
str = unparse(data)
- if RUBY_PLATFORM == "java"
- stream.puts str
- else
- mtx.synchronize { stream.puts str }
- end
+ stream.print(str + "\n")
else
data = data.dup
start = Time.now
log_to_stream(stream, data.merge(at: "start"))
begin
@@ -57,13 +53,9 @@
log_to_stream(stream, data.merge(
at: "exception", elapsed: (Time.now - start).to_f))
raise
end
end
- end
-
- def mtx
- @mtx ||= Mutex.new
end
def quote_string(k, v)
# try to find a quote style that fits
if !v.include?('"')