MCPcopy Index your code
hub / github.com/cloudfoundry/cli / tailLogsFor

Method tailLogsFor

cf/commands/application/logs.go:101–127  ·  view source on GitHub ↗
(app models.Application)

Source from the content-addressed store, hash-verified

99}
100
101func (cmd *Logs) tailLogsFor(app models.Application) error {
102 onConnect := func() {
103 cmd.ui.Say(T("Connected, tailing logs for app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...\n",
104 map[string]interface{}{
105 "AppName": terminal.EntityNameColor(app.Name),
106 "OrgName": terminal.EntityNameColor(cmd.config.OrganizationFields().Name),
107 "SpaceName": terminal.EntityNameColor(cmd.config.SpaceFields().Name),
108 "Username": terminal.EntityNameColor(cmd.config.Username())}))
109 }
110
111 c := make(chan logs.Loggable)
112 e := make(chan error)
113
114 go cmd.logsRepo.TailLogsFor(app.GUID, onConnect, c, e)
115
116 for {
117 select {
118 case msg, ok := <-c:
119 if !ok {
120 return nil
121 }
122 cmd.ui.Say("%s", msg.ToLog(time.Local))
123 case err := <-e:
124 return cmd.handleError(err)
125 }
126 }
127}
128
129func (cmd *Logs) handleError(err error) error {
130 switch err.(type) {

Callers 1

ExecuteMethod · 0.95

Calls 8

handleErrorMethod · 0.95
EntityNameColorFunction · 0.92
SayMethod · 0.65
OrganizationFieldsMethod · 0.65
SpaceFieldsMethod · 0.65
UsernameMethod · 0.65
TailLogsForMethod · 0.65
ToLogMethod · 0.65

Tested by

no test coverage detected