Files

Lumberjack

Constants

LINE_SEPARATOR

Public Class Methods

unit_of_work() click to toggle source

Define a unit of work within a block. Within the block supplied to this method, calling unit_of_work_id will return the same 12 digit hexadecimal number string. This can then be used for tying together log entries.

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 23
def unit_of_work
  save_val = Thread.current[:lumberjack_logger_unit_of_work_id]
  Thread.current[:lumberjack_logger_unit_of_work_id] = rand(0xFFFFFFFFFFFF).to_s(16).rjust(12, '0').upcase
  begin
    return yield
  ensure
    Thread.current[:lumberjack_logger_unit_of_work_id] = save_val
  end
end
unit_of_work_id() click to toggle source

Get the UniqueIdentifier for the current unit of work.

# File lib/lumberjack.rb, line 34
def unit_of_work_id
  Thread.current[:lumberjack_logger_unit_of_work_id] 
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.