class Rforward::CLI

Public Instance Methods

create_config() click to toggle source
# File lib/rforward.rb, line 31
def create_config
  Config.instance.create_sample_config config_path
rescue ConfigNotFoundEx => e
  RLogger.instance.error e.message
end
process_logs(path, ext=".log") click to toggle source
# File lib/rforward.rb, line 19
def process_logs path, ext=".log"
  check_config
  dependencies
  DirectoryProcessor.call path, ext
  RLogger.instance.info "#{path} logs extensions #{ext}"
  puts "Work finidhed press any key"
  STDIN.gets
rescue ConfigNotFoundEx => e
  RLogger.instance.error e.message
end

Private Instance Methods

check_config() click to toggle source
# File lib/rforward.rb, line 38
def check_config
  raise ConfigNotFoundEx, config_path.to_path unless config_path.file? && config_path.exist?
  Config.instance.load_config config_path
end
config_path() click to toggle source
# File lib/rforward.rb, line 43
def config_path
  @config_path ||= Pathname.new(File.join(ENV['ROOT_PATH'], 'rforward.yml'))
end
dependencies() click to toggle source
# File lib/rforward.rb, line 47
def dependencies
  Config.register Config::FLUENTD do
    host, port, tag = Config.instance[:fluentd_host], Config.instance[:fluentd_port], Config.instance[:tag]
    Fluent::Logger::FluentLogger.new(nil, host: host, port: port.to_i)
  end
end