Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite8f0826

Browse files
committed
Agent logging in appstest
Signed-off-by: Spike Curtis <spike@coder.com>
1 parenta04ed7f commite8f0826

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

‎agent/agent.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (_
648648
}
649649
break
650650
}
651+
logger.Debug(ctx,"accepted pty conn",slog.F("remote",conn.RemoteAddr().String()))
651652
wg.Add(1)
652653
closed:=make(chanstruct{})
653654
gofunc() {
@@ -676,6 +677,7 @@ func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (_
676677
varmsg codersdk.WorkspaceAgentReconnectingPTYInit
677678
err=json.Unmarshal(data,&msg)
678679
iferr!=nil {
680+
logger.Warn(ctx,"failed to unmarshal init",slog.F("raw",data))
679681
return
680682
}
681683
_=a.handleReconnectingPTY(ctx,logger,msg,conn)
@@ -787,6 +789,7 @@ func (a *agent) runCoordinator(ctx context.Context, network *tailnet.Conn) error
787789
}
788790

789791
func (a*agent)runStartupScript(ctx context.Context,scriptstring)error {
792+
a.logger.Debug(ctx,"running agent startup script")
790793
returna.runScript(ctx,"startup",script)
791794
}
792795

‎coderd/workspaceapps/apptest/setup.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/stretchr/testify/assert"
1717
"github.com/stretchr/testify/require"
1818

19+
"cdr.dev/slog"
1920
"cdr.dev/slog/sloggers/slogtest"
2021
"github.com/coder/coder/agent"
2122
"github.com/coder/coder/coderd/coderdtest"
@@ -364,7 +365,7 @@ func createWorkspaceWithApps(t *testing.T, client *codersdk.Client, orgID uuid.U
364365
}
365366
agentCloser:=agent.New(agent.Options{
366367
Client:agentClient,
367-
Logger:slogtest.Make(t,nil).Named("agent"),
368+
Logger:slogtest.Make(t,nil).Named("agent").Leveled(slog.LevelDebug),
368369
})
369370
t.Cleanup(func() {
370371
_=agentCloser.Close()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp