Class: Log4r::YamlConfigurator

Inherits:
Object
  • Object
show all
Defined in:
lib/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



24
# File 'lib/log4r/yamlconfigurator.rb', line 24

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

.[]=(param, value) ⇒ Object

Define a parameter with a value



26
# File 'lib/log4r/yamlconfigurator.rb', line 26

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

.custom_levels(levels) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/log4r/yamlconfigurator.rb', line 29

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.



41
42
43
# File 'lib/log4r/yamlconfigurator.rb', line 41

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.



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

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