diff options
Diffstat (limited to 'scopes/lspace.rb')
-rwxr-xr-x | scopes/lspace.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scopes/lspace.rb b/scopes/lspace.rb new file mode 100755 index 0000000..cf027e1 --- /dev/null +++ b/scopes/lspace.rb @@ -0,0 +1,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!"}) |