blob: cf027e13c807d1f27396acde2268f87bd80f2b51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# frozen_string_literal: true
require 'lspace'
def log(str)
puts "#{LSpace[:log_prefix]}: #{str}"
end
def handle_request(req)
LSpace.with(log_prefix: "handling request") do
log Time.now
log req[:status]
log req[:body]
end
Lspace.with(log_prefix: "app") do
log "request handled"
end
end
handle_request({status: 200, body: "success!"})
|