Module: Bugwatch::BreadcrumbCollector
- Defined in:
- lib/bugwatch/breadcrumb_collector.rb
Constant Summary collapse
- THREAD_KEY =
:bugwatch_breadcrumbs- MAX_CRUMBS =
50
Class Method Summary collapse
Class Method Details
.add(message, type: "manual", metadata: {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/bugwatch/breadcrumb_collector.rb', line 6 def self.add(, type: "manual", metadata: {}) crumbs = Thread.current[THREAD_KEY] ||= [] crumbs << { timestamp: Time.now.utc.iso8601(3), type: type, message: .to_s, metadata: } crumbs.shift if crumbs.size > MAX_CRUMBS end |
.all ⇒ Object
17 18 19 |
# File 'lib/bugwatch/breadcrumb_collector.rb', line 17 def self.all Thread.current[THREAD_KEY] || [] end |
.clear ⇒ Object
21 22 23 |
# File 'lib/bugwatch/breadcrumb_collector.rb', line 21 def self.clear Thread.current[THREAD_KEY] = [] end |