Class: Log4r::YamlConfigurator
- Inherits:
-
Object
- Object
- Log4r::YamlConfigurator
- Defined in:
- lib/j1_app/log4r/yamlconfigurator.rb
Overview
See log4r/yamlconfigurator.rb
Constant Summary collapse
- @@params =
Hash.new
Class Method Summary collapse
-
.[](param) ⇒ Object
Get a parameter’s value.
-
.[]=(param, value) ⇒ Object
Define a parameter with a value.
- .custom_levels(levels) ⇒ Object
-
.load_yaml_file(filename) ⇒ Object
Given a filename, loads the YAML configuration for Log4r.
-
.load_yaml_string(string) ⇒ Object
You can load a String YAML configuration instead of a file.
Class Method Details
.[](param) ⇒ Object
Get a parameter’s value
18 |
# File 'lib/j1_app/log4r/yamlconfigurator.rb', line 18 def self.[](param); @@params[param] end |
.[]=(param, value) ⇒ Object
Define a parameter with a value
20 |
# File 'lib/j1_app/log4r/yamlconfigurator.rb', line 20 def self.[]=(param, value); @@params[param] = value end |
.custom_levels(levels) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/j1_app/log4r/yamlconfigurator.rb', line 23 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.
35 36 37 |
# File 'lib/j1_app/log4r/yamlconfigurator.rb', line 35 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.
40 41 42 |
# File 'lib/j1_app/log4r/yamlconfigurator.rb', line 40 def self.load_yaml_string( string) actual_load( string) end |