Skip to content

Commit 866d44c

Browse files
committed
refactor(log): ConnectToLogs
Now it is a proxy for `RemoteSub("sub log-drain -k")`
1 parent 57a5727 commit 866d44c

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

log/log.go

+1-27
Original file line numberDiff line numberDiff line change
@@ -272,31 +272,5 @@ var _ io.Writer = (*PubSubLogWriter)(nil)
272272
var _ slog.Handler = (*MultiHandler)(nil)
273273

274274
func ConnectToLogs(ctx context.Context, connectionInfo *pubsub.RemoteClientInfo) (io.Reader, error) {
275-
sshClient, err := pubsub.CreateRemoteClient(connectionInfo)
276-
if err != nil {
277-
return nil, err
278-
}
279-
280-
session, err := sshClient.NewSession()
281-
if err != nil {
282-
return nil, err
283-
}
284-
285-
stdoutPipe, err := session.StdoutPipe()
286-
if err != nil {
287-
return nil, err
288-
}
289-
290-
err = session.Start("sub log-drain -k")
291-
if err != nil {
292-
return nil, err
293-
}
294-
295-
go func() {
296-
<-ctx.Done()
297-
session.Close()
298-
sshClient.Close()
299-
}()
300-
301-
return stdoutPipe, nil
275+
return pubsub.RemoteSub("sub log-drain -k", ctx, connectionInfo)
302276
}

0 commit comments

Comments
 (0)