Sha256: df26a7ed0016c47fa4baf1dbfbec6e467a3fdfcd7855a185c7a4785d808839d1

Contents?: true

Size: 628 Bytes

Versions: 2

Compression:

Stored size: 628 Bytes

Contents

namespace :load do
  task :defaults do
    set :taillog_roles, -> { :app }
  end
end

namespace :taillog do
  desc 'Tail application log'
  task :application_log do
    on roles(fetch(:taillog_roles)) do
      tail "#{shared_path}/log/#{fetch(:rails_env)}.log"
    end
  end

  def with_verbosity(output_verbosity)
    old_verbosity = SSHKit.config.output_verbosity

    begin
      SSHKit.config.output_verbosity = output_verbosity
      yield
    ensure
      SSHKit.config.output_verbosity = old_verbosity
    end
  end

  def tail(path)
    with_verbosity(Logger::DEBUG) do
      execute "tail -f #{path}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capistrano3-taillog-1.1.0 lib/capistrano3/tasks/taillog.cap
capistrano3-taillog-1.0.0 lib/capistrano3/tasks/taillog.cap