Module: Notarius
- Defined in:
- lib/notarius.rb,
lib/notarius/config.rb,
lib/notarius/version.rb,
lib/notarius/formatter.rb,
lib/notarius/secretary.rb
Overview
Notarius is a logging library with opinions.
Defined Under Namespace
Classes: Config, Formatter, Secretary
Constant Summary collapse
- VERSION =
Semantic versioning makes life easier.
'0.2.6'
Class Method Summary collapse
-
.config(name) ⇒ Config?
Gets the configuration for a module.
-
.configure(name) {|log| ... } ⇒ void
Configures a logging module.
Class Method Details
.config(name) ⇒ Config?
Gets the configuration for a module.
48 49 50 51 |
# File 'lib/notarius.rb', line 48 def self.config name validate name @configs[name] end |
.configure(name) {|log| ... } ⇒ void
This method returns an undefined value.
Configures a logging module. If a matching module exists, it will be reconfigured. Otherwise, a new module will be created.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/notarius.rb', line 25 def self.configure name, &block name = namespace name @configs[name] ||= Config.new block.call @configs[name] if block return if self.const_defined? name mod = Module.new do define_method :log do @secretary ||= Secretary.new @secretary.configure Notarius.config(name) @secretary end end self.const_set name, mod end |