Module: Traces::Backend::Console::Interface
- Defined in:
- lib/traces/backend/console.rb
Instance Method Summary collapse
-
#trace(name, resource: self, attributes: {}, &block) ⇒ Object
Trace the given block of code and log the execution.
-
#trace_context ⇒ Object
Get a trace context from the current execution scope.
-
#trace_context=(context) ⇒ Object
Assign a trace context to the current execution scope.
Instance Method Details
#trace(name, resource: self, attributes: {}, &block) ⇒ Object
Trace the given block of code and log the execution.
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/traces/backend/console.rb', line 41 def trace(name, resource: self, attributes: {}, &block) context = Context.nested(Fiber.current.traces_backend_context) Fiber.current.traces_backend_context = context ::Console.logger.info(resource, name, attributes) if block.arity.zero? yield else yield Span.new(context, self, name) end end |
#trace_context ⇒ Object
Get a trace context from the current execution scope.
60 61 62 |
# File 'lib/traces/backend/console.rb', line 60 def trace_context Fiber.current.traces_backend_context end |
#trace_context=(context) ⇒ Object
Assign a trace context to the current execution scope.
55 56 57 |
# File 'lib/traces/backend/console.rb', line 55 def trace_context= context Fiber.current.traces_backend_context = context end |