Class: CFTools::Tunnel::WatchLogs

Inherits:
Base
  • Object
show all
Defined in:
lib/tools-cf-plugin/tunnel/watch-logs.rb

Constant Summary collapse

LOGS =
{
  "api_z1" => ["cloud_controller_ng/cloud_controller_ng.log"],
  "api_z2" => ["cloud_controller_ng/cloud_controller_ng.log"],
  "runner_z1" => ["dea_next/dea_next.log"],
  "runner_z2" => ["dea_next/dea_next.log"],
  "hm_z1" => ["health_manager_next/health_manager_next.log"],
  "router_z1" => ["gorouter/gorouter.log"],
  "router_z2" => ["gorouter/gorouter.log"],
}

Constants inherited from Base

Base::BOSH_CONFIG

Instance Method Summary collapse

Methods inherited from Base

#authenticate_with_director, #connected_director, #current_deployment, #director, #login_to_director, #precondition, #tunnel_to

Instance Method Details

#color?Boolean

colorize if told to; don’t check if output is tty

Returns:

  • (Boolean)


21
22
23
# File 'lib/tools-cf-plugin/tunnel/watch-logs.rb', line 21

def color?
  input[:color]
end

#watch_logsObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/tools-cf-plugin/tunnel/watch-logs.rb', line 30

def watch_logs
  director_host = input[:director]
  components = input[:components]
  gateway = input[:gateway]

  director = connected_director(director_host, gateway)

  deployment = current_deployment(director)

  locations =
    with_progress("Finding logs for #{c(deployment["name"], :name)}") do
      locs = stream_locations(director, deployment["name"], components)

      if locs.empty?
        fail "No locations found."
      else
        locs
      end
    end

  stream = stream_for(director, deployment["name"], gateway)

  stream.stream(locations) do |entry|
    line pretty_print_entry(entry)
  end
end