summaryrefslogtreecommitdiff
path: root/scopes/lspace.rb
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2022-07-12 16:34:53 -0500
committerGrant Shangreaux <grant@unabridgedsoftware.com>2022-07-12 16:34:53 -0500
commit79dd7f85720d2402634304530d446f24b920839d (patch)
tree8c5253ffd2d8f3c81351f8d6fe6ad579afb44f37 /scopes/lspace.rb
Add: scopes-and-bindings talkmaster
Diffstat (limited to 'scopes/lspace.rb')
-rwxr-xr-xscopes/lspace.rb21
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!"})