pubsub
created pr with
28.1
added 28.2
1: 57a5727 = 1: 57a5727 refactor: create remote client lib
-: ------- > 2: 67d38ff refactor(log): rm ConnectToLogs
added 28.3
1: 57a5727 = 1: 57a5727 refactor: create remote client lib
2: 67d38ff = 2: 67d38ff refactor(log): rm ConnectToLogs
-: ------- > 3: 97084b4 refactor(log): preserve `ConnectToLogs` but make it a convenient proxy
added 28.4
1: 57a5727 = 1: 57a5727 refactor: create remote client lib
2: 67d38ff ! 2: 866d44c refactor(log): `ConnectToLogs`
3: 97084b4 < -: ------- refactor(log): preserve `ConnectToLogs` but make it a convenient proxy
cmds
checkout latest patchset:
ssh pr.pico.sh print 28 | git am -3checkout any patchset in a patch request:
ssh pr.pico.sh print 28.[rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 28
Patchset
28.3
refactor(log): rm ConnectToLogs
Eric Bower
2024-11-12T15:08:41ZWe can just use `RemoteSub("sub log-drain -k")`
Semantic diff summary
0 added,
0 modified,
0 signature changed,
1 removed
across 1 analyzed file
+0
-30
log/log.go
#
| ... | ... | @@ -270,33 +270,3 @@ func SendLogRegister(logger *slog.Logger, connectionInfo *pubsub.RemoteClientInf | |
| 270 | 270 | ||
| 271 | 271 | var _ io.Writer = (*PubSubLogWriter)(nil) | |
| 272 | 272 | var _ slog.Handler = (*MultiHandler)(nil) | |
| 273 | - | ||
| 274 | - | 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 | |
| 302 | - | } |