Class Cabin::Context
In: lib/cabin/context.rb
lib/cabin/context.rb
Parent: Object

Logging context exists to make it easy to add and later undo any changes made to the context data associated with a given Logging::Channel

Usage:

    context = channel.context
    context["foo"] = "Hello world!"
    channel.info("Sample log") # output includes { "foo" => "Hello world!" }
    context.clear
    channel.info("Sample log 2") # context cleared, key "foo" removed.

Essentially, a Cabin::Context acts as a transactional proxy on top of a Cabin::Channel. Any changes you make in a context are passed through to the channel while keeping an ordered record of the changes made so you can unroll those changes when the context is no longer needed..

Methods

[]   []   []=   []=   clear   clear   new   new   on_clear   on_clear  

Public Class methods

Public Instance methods

Undo any changes made to the channel by this context.

Undo any changes made to the channel by this context.

[Validate]