Class: Himari::Config
- Inherits:
-
Object
- Object
- Himari::Config
- Defined in:
- lib/himari/config.rb
Instance Attribute Summary collapse
-
#custom_messages ⇒ Object
readonly
Returns the value of attribute custom_messages.
-
#custom_templates ⇒ Object
readonly
Returns the value of attribute custom_templates.
-
#issuer ⇒ Object
readonly
Returns the value of attribute issuer.
-
#preserve_rack_logger ⇒ Object
readonly
Returns the value of attribute preserve_rack_logger.
-
#providers ⇒ Object
readonly
Returns the value of attribute providers.
-
#release_fragment ⇒ Object
readonly
Returns the value of attribute release_fragment.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
Instance Method Summary collapse
-
#initialize(issuer:, storage:, providers: [], log_output: $stdout, log_level: Logger::INFO, preserve_rack_logger: false, custom_templates: {}, custom_messages: {}, release_fragment: nil) ⇒ Config
constructor
A new instance of Config.
- #logger ⇒ Object
Constructor Details
#initialize(issuer:, storage:, providers: [], log_output: $stdout, log_level: Logger::INFO, preserve_rack_logger: false, custom_templates: {}, custom_messages: {}, release_fragment: nil) ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/himari/config.rb', line 8 def initialize(issuer:, storage:, providers: [], log_output: $stdout, log_level: Logger::INFO, preserve_rack_logger: false, custom_templates: {}, custom_messages: {}, release_fragment: nil) @issuer = issuer @providers = providers @storage = storage @log_output = log_output @log_level = log_level @preserve_rack_logger = preserve_rack_logger @custom_messages = @custom_templates = custom_templates @release_fragment = release_fragment end |
Instance Attribute Details
#custom_messages ⇒ Object (readonly)
Returns the value of attribute custom_messages.
22 23 24 |
# File 'lib/himari/config.rb', line 22 def @custom_messages end |
#custom_templates ⇒ Object (readonly)
Returns the value of attribute custom_templates.
22 23 24 |
# File 'lib/himari/config.rb', line 22 def custom_templates @custom_templates end |
#issuer ⇒ Object (readonly)
Returns the value of attribute issuer.
22 23 24 |
# File 'lib/himari/config.rb', line 22 def issuer @issuer end |
#preserve_rack_logger ⇒ Object (readonly)
Returns the value of attribute preserve_rack_logger.
22 23 24 |
# File 'lib/himari/config.rb', line 22 def preserve_rack_logger @preserve_rack_logger end |
#providers ⇒ Object (readonly)
Returns the value of attribute providers.
22 23 24 |
# File 'lib/himari/config.rb', line 22 def providers @providers end |
#release_fragment ⇒ Object (readonly)
Returns the value of attribute release_fragment.
22 23 24 |
# File 'lib/himari/config.rb', line 22 def release_fragment @release_fragment end |
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
22 23 24 |
# File 'lib/himari/config.rb', line 22 def storage @storage end |
Instance Method Details
#logger ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/himari/config.rb', line 24 def logger @logger ||= Logger.new(@log_output).tap do |l| l.level = @log_level l.formatter = proc do |severity, datetime, progname, msg| log = {time: datetime.xmlschema, severity: severity.to_s, pid: Process.pid} case msg when Himari::LogLine log[:message] = msg. log[:data] = msg.data else log[:message] = msg.to_s end "#{JSON.generate(log)}\n" end end end |