Module: Log

Defined in:
lib/batlog.rb,
lib/log/log.rb,
lib/log/utils.rb,
lib/log/config.rb,
lib/log/engine.rb,
lib/log/events.rb,
lib/log/version.rb,
lib/log/dispatcher.rb,
app/models/log/db_log.rb,
lib/log/loggable_error.rb,
lib/log/controller_support.rb

Defined Under Namespace

Modules: ControllerSupport, Events Classes: Config, DbLog, Dispatcher, Engine, LoggableError, Utils

Constant Summary collapse

SEVERITIES =
{
  :debug  => 0,
  :info   => 1,
  :warn   => 2,
  :error  => 3,
  :fatal  => 4
}
VERSION =
"0.9.3"

Class Method Summary collapse

Class Method Details

.assert(condition, message, context = {}, severity = :error, raise_error = nil) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/log/log.rb', line 33

def self.assert(condition, message, context = {}, severity=:error, raise_error=nil)
  if condition
    return true
  else
    assert_failed(severity, message, context, raise_error)
    return false
  end
end

.clear_contextObject



55
56
57
# File 'lib/log/log.rb', line 55

def self.clear_context
  Thread.current[:log_context] = nil
end

.clear_eventsObject



46
47
48
# File 'lib/log/log.rb', line 46

def self.clear_events
  Events.reset
end

.configObject



17
18
19
# File 'lib/log/log.rb', line 17

def self.config
  @config ||= Log::Config.default
end

.context(hash = {}) ⇒ Object



50
51
52
53
# File 'lib/log/log.rb', line 50

def self.context(hash = {})
  Thread.current[:log_context] ||= {}
  Thread.current[:log_context].merge!(hash)
end

.event(name, data = {}) ⇒ Object



42
43
44
# File 'lib/log/log.rb', line 42

def self.event(name, data={})
  Events.add(name, data)
end