Class: Log4r::YamlConfigurator

Inherits:
Object
  • Object
show all
Defined in:
lib/j1_app/log4r/yamlconfigurator.rb

Overview

See log4r/yamlconfigurator.rb

Constant Summary collapse

@@params =
Hash.new

Class Method Summary collapse

Class Method Details

.[](param) ⇒ Object

Get a parameter’s value



17
# File 'lib/j1_app/log4r/yamlconfigurator.rb', line 17

def self.[](param); @@params[param] end

.[]=(param, value) ⇒ Object

Define a parameter with a value



19
# File 'lib/j1_app/log4r/yamlconfigurator.rb', line 19

def self.[]=(param, value); @@params[param] = value end

.custom_levels(levels) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/j1_app/log4r/yamlconfigurator.rb', line 21

def self.custom_levels(levels)
  return Logger.root if levels.size == 0
  for i in 0...levels.size
    name = levels[i].to_s
    if name =~ /\s/ or name !~ /^[A-Z]/
      raise TypeError, "#{name} is not a valid Ruby Constant name", caller
    end
  end
  Log4r.define_levels *levels
end

.load_yaml_file(filename) ⇒ Object

Given a filename, loads the YAML configuration for Log4r



33
34
35
# File 'lib/j1_app/log4r/yamlconfigurator.rb', line 33

def self.load_yaml_file(filename)
  actual_load( File.open(filename))
end

.load_yaml_string(string) ⇒ Object

You can load a String YAML configuration instead of a file



38
39
40
# File 'lib/j1_app/log4r/yamlconfigurator.rb', line 38

def self.load_yaml_string(string)
  actual_load(string)
end