lib/splash/cli/logs.rb in prometheus-splash-0.5.2 vs lib/splash/cli/logs.rb in prometheus-splash-0.5.3

- old
+ new

@@ -5,16 +5,16 @@ include Splash::Config include Splash::Exiter include Splash::Logs - desc "analyse", "analyze logs in config" + desc "analyse", "analyze logs defined in Splash config" def analyse log = get_logger results = LogScanner::new res = results.analyse - log.info "SPlash Configured logs status :" + log.info "SPlash Configured log monitors :" full_status = true results.output.each do |result| if result[:status] == :clean then log.ok "Log : #{result[:log]} : no errors" log.item "Detected pattern : #{result[:pattern]}" @@ -28,30 +28,30 @@ log.item "Nb lines = #{result[:lines]}" end full_status = false unless result[:status] == :clean end - display_status = (full_status)? "OK": "KO" + if full_status then log.ok "Global status : no error found" else log.error "Global status : some error found" end splash_exit case: :quiet_exit end - desc "monitor", "monitor logs in config" + desc "monitor", "monitor logs defined in Splash config" def monitor log = get_logger log.level = :fatal if options[:quiet] result = LogScanner::new result.analyse splash_exit result.notify end - desc "show LOG", "show configured log monitoring for LOG" + desc "show LOG", "show Splash configured log monitoring for LOG" def show(logrecord) log = get_logger log_record_set = get_config.logs.select{|item| item[:log] == logrecord } unless log_record_set.empty? then record = log_record_set.first @@ -61,11 +61,11 @@ else splash_exit case: :not_found, :more => "log not configured" end end - desc "list", "Show configured logs monitoring" + desc "list", "List all Splash configured logs monitoring" long_desc <<-LONGDESC Show configured logs monitoring\n with --detail, show logs monitor details LONGDESC option :detail, :type => :boolean, :aliases => "-D" @@ -75,10 +75,10 @@ log_record_set = get_config.logs log.ko 'No configured commands found' if log_record_set.empty? log_record_set.each do |record| log.item "log monitor : #{record[:log]}" if options[:detail] then - log.flat " -> pattern : /#{record[:pattern]}/" + log.arrow "pattern : /#{record[:pattern]}/" end end splash_exit case: :quiet_exit end