feat(codersdk/agentsdk): export LogDest interface (#13792)

Signed-off-by: Cian Johnston <cian@coder.com>
This commit is contained in:
Cian Johnston
2024-07-04 14:04:43 +01:00
committed by GitHub
parent dd80958efb
commit c2d44d16a3

View File

@ -284,7 +284,7 @@ type LogSender struct {
outputLen int outputLen int
} }
type logDest interface { type LogDest interface {
BatchCreateLogs(ctx context.Context, request *proto.BatchCreateLogsRequest) (*proto.BatchCreateLogsResponse, error) BatchCreateLogs(ctx context.Context, request *proto.BatchCreateLogsRequest) (*proto.BatchCreateLogsResponse, error)
} }
@ -360,7 +360,7 @@ var LogLimitExceededError = xerrors.New("Log limit exceeded")
// SendLoop sends any pending logs until it hits an error or the context is canceled. It does not // SendLoop sends any pending logs until it hits an error or the context is canceled. It does not
// retry as it is expected that a higher layer retries establishing connection to the agent API and // retry as it is expected that a higher layer retries establishing connection to the agent API and
// calls SendLoop again. // calls SendLoop again.
func (l *LogSender) SendLoop(ctx context.Context, dest logDest) error { func (l *LogSender) SendLoop(ctx context.Context, dest LogDest) error {
l.L.Lock() l.L.Lock()
defer l.L.Unlock() defer l.L.Unlock()
if l.exceededLogLimit { if l.exceededLogLimit {