module Lumberjack
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
frozen_string_literals: true
Constants
- LINE_SEPARATOR
Public Class Methods
Define a unit of work within a block. Within the block supplied to this method, calling unit_of_work_id
will return the same value that can This can then be used for tying together log entries.
You can specify the id for the unit of work if desired. If you don't supply it, a 12 digit hexidecimal number will be automatically generated for you.
For the common use case of treating a single web request as a unit of work, see the Lumberjack::Rack::UnitOfWork
class.
# File lib/lumberjack.rb, line 29 def unit_of_work(id = nil) save_val = Thread.current[:lumberjack_logger_unit_of_work_id] id ||= SecureRandom.hex(6) Thread.current[:lumberjack_logger_unit_of_work_id] = id begin return yield ensure Thread.current[:lumberjack_logger_unit_of_work_id] = save_val end end
Get the UniqueIdentifier for the current unit of work.
# File lib/lumberjack.rb, line 41 def unit_of_work_id Thread.current[:lumberjack_logger_unit_of_work_id] end