Class: Smith::Commands::Logger
- Inherits:
-
Smith::CommandBase
- Object
- Smith::CommandBase
- Smith::Commands::Logger
- Defined in:
- lib/smith/commands/agency/logger.rb
Instance Attribute Summary
Attributes inherited from Smith::CommandBase
Instance Method Summary collapse
Methods inherited from Smith::CommandBase
#banner, #format_help, #initialize, #parse_options
Methods included from Logger
Constructor Details
This class inherits a constructor from Smith::CommandBase
Instance Method Details
#_logger(&blk) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/smith/commands/agency/logger.rb', line 9 def _logger(&blk) = [] if [:level].nil? << "No log level. You must specify a log level and a target" else case target.first when 'all' agents.state(:running).each do |agent| << set_log_level(agent.uuid) end '' when 'agency' begin logger.info { "Setting agency log level to: #{[:level]}" } log_level([:level]) rescue ArgumentError m = "Incorrect log level: #{[:level]}" logger.error { m } << m end '' when nil << "No target. You must specify one of the following: 'agency', 'all' or a list of agents" else target.each do |uuid| << set_log_level(uuid) end end end .compact.join(", ") end |
#execute ⇒ Object
5 6 7 |
# File 'lib/smith/commands/agency/logger.rb', line 5 def execute responder.succeed((_logger)) end |