Class: ElasticGraph::Support::Logger::Config
- Inherits:
-
Object
- Object
- ElasticGraph::Support::Logger::Config
- Defined in:
- lib/elastic_graph/support/logger.rb
Constant Summary collapse
- EXPECTED_KEYS =
members.map(&:to_s)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_parsed_yaml(hash) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/elastic_graph/support/logger.rb', line 63 def self.from_parsed_yaml(hash) hash = hash.fetch("logger") extra_keys = hash.keys - EXPECTED_KEYS unless extra_keys.empty? raise ConfigError, "Unknown `logger` config settings: #{extra_keys.join(", ")}" end new( level: hash["level"] || "INFO", device: hash.fetch("device"), formatter: ::Object.const_get(hash.fetch("formatter", JSONAwareFormatter.name)).new ) end |
Instance Method Details
#prepared_device ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/elastic_graph/support/logger.rb', line 53 def prepared_device case device when "stdout" then $stdout when "stderr" then $stderr else ::Pathname.new(device).parent.mkpath device end end |