Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tilebox.com/llms.txt

Use this file to discover all available pages before exploring further.

func (*JobClient) QueryLogs(
    ctx context.Context,
    jobID uuid.UUID,
    options ...workflows.TelemetryQueryOption,
) iter.Seq2[*workflows.LogRecord, error]
Query log records emitted while running a job. The logs are lazily loaded and returned as a sequence of log records. Use Collect to transform the sequence into a slice.

Parameters

jobID
uuid.UUID
required
The ID of the job to query logs for.
options
[]workflows.TelemetryQueryOption
Options for querying logs.

Options

WithSortDirection(direction workflows.SortDirection)
Sort logs by time. Use workflows.Ascending for oldest first or workflows.Descending for newest first.
WithLimit(limit int64)
Limit the number of log records returned.

Returns

A sequence of log records. Each record includes Time, Level, Body, and structured attributes.
import (
    "fmt"
    "log/slog"
    "time"

    "github.com/google/uuid"
    "github.com/tilebox/tilebox-go/workflows/v1"
)

jobID := uuid.MustParse("019e07b1-916b-0630-f3ba-f1c33235d174")

for record, err := range client.Jobs.QueryLogs(
    ctx,
    jobID,
    workflows.WithSortDirection(workflows.Ascending),
) {
    if err != nil {
        slog.ErrorContext(ctx, "failed to query job logs", slog.Any("error", err))
        return
    }

    fmt.Printf("%s %-5s %s\n",
        record.Time.Format(time.RFC3339),
        record.Level,
        record.Body,
    )
}