Class: GrayLogger::Configuration
- Inherits:
-
Object
- Object
- GrayLogger::Configuration
- Includes:
- Support
- Defined in:
- lib/gray_logger/configuration.rb
Instance Attribute Summary collapse
-
#automatic_logging ⇒ Object
Returns the value of attribute automatic_logging.
-
#host ⇒ Object
Returns the value of attribute host.
-
#logger_level ⇒ Object
Returns the value of attribute logger_level.
-
#options ⇒ Object
Returns the value of attribute options.
-
#port ⇒ Object
Returns the value of attribute port.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
- #automatic_logging? ⇒ Boolean
-
#initialize(configuration_hash) ⇒ Configuration
constructor
A new instance of Configuration.
- #valid? ⇒ Boolean
Methods included from Support
Constructor Details
#initialize(configuration_hash) ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gray_logger/configuration.rb', line 6 def initialize(configuration_hash) unless configuration_hash.nil? configuration = configuration_hash.dup defaults = { :size => "WAN", :facility => "facility-not-defined" } config = symbolize_keys(configuration) config = defaults.merge(config) [:host, :port, :size, :automatic_logging, :logger_level].each do |method| send("#{method}=", config.delete(method)) end self. = config end end |
Instance Attribute Details
#automatic_logging ⇒ Object
Returns the value of attribute automatic_logging.
5 6 7 |
# File 'lib/gray_logger/configuration.rb', line 5 def automatic_logging @automatic_logging end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/gray_logger/configuration.rb', line 5 def host @host end |
#logger_level ⇒ Object
Returns the value of attribute logger_level.
5 6 7 |
# File 'lib/gray_logger/configuration.rb', line 5 def logger_level @logger_level end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/gray_logger/configuration.rb', line 5 def @options end |
#port ⇒ Object
Returns the value of attribute port.
5 6 7 |
# File 'lib/gray_logger/configuration.rb', line 5 def port @port end |
#size ⇒ Object
Returns the value of attribute size.
5 6 7 |
# File 'lib/gray_logger/configuration.rb', line 5 def size @size end |
Instance Method Details
#automatic_logging? ⇒ Boolean
31 32 33 |
# File 'lib/gray_logger/configuration.rb', line 31 def automatic_logging? @automatic_logging.nil? ? true : !!@automatic_logging end |
#valid? ⇒ Boolean
24 25 26 27 28 29 |
# File 'lib/gray_logger/configuration.rb', line 24 def valid? invalid_host = self.host.nil? invalid_port = self.port.nil? invalid_size = self.size.nil? !(invalid_host || invalid_port || invalid_size) end |