logging

package
v0.1.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package logging is the service's log: JSON lines on one stream, in the keys Cloud Logging reads, held to the table of events in events.go.

Every line goes through guard, which writes only what the table allows. So the rule that the log carries no direct identifier, IP address, work, reading or hint text (R09 spec; privacy 4 spec) does not rest on each line's author remembering it: a field the table does not give the event is dropped and counted, and an event the table does not know loses its message. The libraries in the process — tutor, module-kit and the rest — are handed this same *slog.Logger, and their lines pass the same guard.

Index

Constants

View Source
const (
	// EventStartup is the line that says a revision has started, which build it
	// runs, and what it declared for admission to AI (R25, R45). The delivery
	// finds a revision's release by it.
	EventStartup = "startup"
	// EventStopping is the line that says a stop was asked for.
	EventStopping = "stopping"
	// EventStopped is the line that says the server has drained.
	EventStopped = "stopped"
	// EventShutdown is the last line of a process that stopped as asked.
	EventShutdown = "shutdown"
	// EventFailure is a failure nobody asked for, at a moment of the closed set
	// the field moment names, and in the daily job, at which of its steps.
	EventFailure = "failure"
	// EventPanic is a panic a handler raised and the server recovered.
	EventPanic = "panic"
	// EventMigrated is the line that says the migrations of a database ran: how many
	// it applied, the version the schema is at, and, for the rights', whether it
	// made the store and wrote the model.
	EventMigrated = "migrated"
	// EventRequest is the line of a request of the protocol: its method, its code,
	// the cause of a refusal, the class of a refused token, how long it ran and,
	// when it failed, the kind of the failure — never its body, headers, address
	// or an ID (R18, R33). The path of a Connect GET holds the message, so the
	// method is written, not the path.
	EventRequest = "request"
	// EventSwept is the line of a step of the daily job (R21) or of the job after
	// a rollout (R07): which step, how many
	// it did and failed, and whether it went to its end — counts alone, never an
	// ID of what it did them to.
	EventSwept = "swept"
	// EventPackagesLaid is the line of api packages that laid the packages of the
	// pinned release of modules into a folder (R07, R41): the release, and how many
	// packages and files of their device parts it laid.
	EventPackagesLaid = "packages_laid"
	// EventPackageFile is the line of a request for a file of a device part, which
	// is no method of Connect (R18, R42): its HTTP status, how long it ran and, when
	// it failed, the kind of the failure — never its path, which names the package
	// and the file.
	EventPackageFile = "package_file"
	// EventAdmission is the line of api check that says what it found the
	// deployment to declare for admission to AI (R25, R45): the version of the
	// table, whether a file of facts was given, and the least stage and whether it
	// was named, so that the operator sees what is missing — never a provider, a
	// fact or a path.
	EventAdmission = "admission"
	// EventAIUsage is the line of what one model of a call of AI took, beside the
	// line of the request that made the call (R12, R46): the method, the provider
	// and the model, its tokens, how the call ended and how long it took — never
	// the work, what was read or what failed in its words.
	EventAIUsage = "ai_usage"
)

The events of the service's own lines.

View Source
const (
	FieldVersion       = "version"
	FieldCommit        = "commit"
	FieldDate          = "date"
	FieldPort          = "port"
	FieldDeployed      = "deployed"
	FieldStarted       = "started"
	FieldCutShort      = "cut_short"
	FieldMoment        = "moment"
	FieldErrorKind     = "error_kind"
	FieldPanicKind     = "panic_kind"
	FieldApplied       = "applied"
	FieldSchemaVersion = "schema_version"
	FieldDatabase      = "database"
	FieldStoreCreated  = "store_created"
	FieldModelWritten  = "model_written"
	FieldMethod        = "method"
	FieldCode          = "code"
	FieldCause         = "cause"
	FieldTokenClass    = "token_class"
	FieldDurationMS    = "duration_ms"
	FieldStep          = "step"
	FieldDone          = "done"
	FieldFailed        = "failed"
	FieldFinished      = "finished"
	// FieldModulesRelease is the release of modules that modules.json pins.
	FieldModulesRelease = "modules_release"
	FieldPackages       = "packages"
	FieldFiles          = "files"
	// FieldStatus is the HTTP status of an answer.
	FieldStatus = "status"
	// FieldAdmissionTable is the version of the admission table, MAJOR.MINOR.
	FieldAdmissionTable = "admission_table"
	// FieldFactsFile says whether the deployment named a file of facts.
	FieldFactsFile = "facts_file"
	// FieldRung is the least stage of the rule of admission of models.
	FieldRung = "rung"
	// FieldRungSet says whether the deployment named the stage, rather than
	// taking full by default.
	FieldRungSet = "rung_set"
	// FieldPlatformKeys is how many providers the platform holds a key of.
	FieldPlatformKeys = "platform_keys"
	// FieldLegalDir says whether the deployment names a folder of its own legal
	// texts, rather than serving those of spec's tag.
	FieldLegalDir = "legal_dir"
	// FieldConsentForms is the store of the scans of the forms of consent: a
	// word of FormsStores.
	FieldConsentForms = "consent_forms"
	// FieldOutcomeCause is the cause of the outcome of an answer that was no
	// refusal: a call of AI that gave no reading.
	FieldOutcomeCause = "outcome_cause"
	// FieldProvider is a provider of AI, by its code in the admission table.
	FieldProvider = "provider"
	// FieldModel is a model of a provider, by the ID the provider answered with.
	FieldModel          = "model"
	FieldInputTokens    = "input_tokens"
	FieldOutputTokens   = "output_tokens"
	FieldThinkingTokens = "thinking_tokens"
	// FieldAIOutcome is how a call of AI ended, in a word of AIOutcomes.
	FieldAIOutcome = "ai_outcome"
)

The fields.

View Source
const (
	MomentStartup   = "startup"
	MomentServe     = "serve"
	MomentShutdown  = "shutdown"
	MomentMigrate   = "migrate"
	MomentInvite    = "invite"
	MomentCountries = "countries"
	MomentSweep     = "sweep"
	MomentPackages  = "packages"
	MomentAfter     = "after"
	MomentConsents  = "consents"
	MomentReports   = "reports"
)

The moments of a failure: the value set of FieldMoment.

View Source
const (
	StepMarks             = "marks"
	StepIdleAccounts      = "idle_accounts"
	StepIdleProfiles      = "idle_profiles"
	StepGoneAttempts      = "gone_attempts"
	StepGoneRuns          = "gone_runs"
	StepAbandonedAttempts = "abandoned_attempts"
	StepEvidence          = "evidence"
	StepAbandonedRuns     = "abandoned_runs"
	StepUsers             = "users"
	StepTuples            = "tuples"
	StepConsentRecords    = "consent_records"
	StepConsentForms      = "consent_forms"
	StepProblemReports    = "problem_reports"
	StepKeys              = "keys"
	StepChangelog         = "changelog"
)

The steps of the daily job and of the job after a rollout: the value set of FieldStep.

View Source
const (
	DatabaseAPI     = "api"
	DatabaseOpenFGA = "openfga"
)

The databases api migrates: the value set of FieldDatabase.

Variables

View Source
var AIOutcomes = []string{"answered", "failed", "limit_reached", "not_admitted", "key_refused"}

AIOutcomes is the value set of FieldAIOutcome: how a call of tutor ended, in tutor's kinds (R46).

AfterSteps is every step of the job after a rollout, in the order it takes them: the steps of the daily job that close what the image no longer gives (R07).

View Source
var Codes = []string{
	"ok", "canceled", "unknown", "invalid_argument", "deadline_exceeded", "not_found",
	"already_exists", "permission_denied", "resource_exhausted", "failed_precondition",
	"aborted", "out_of_range", "unimplemented", "internal", "unavailable", "data_loss",
	"unauthenticated",
}

Codes is the value set of FieldCode: Connect's codes in Connect's words, and ok for a request that was not refused.

View Source
var FormsStores = []string{"none", "bucket", "folder"}

FormsStores is every store of the scans of the forms of consent: the value set of FieldConsentForms.

View Source
var Providers = []string{"anthropic", "google", "openai"}

Providers is the value set of FieldProvider: the providers of the admission table, by their codes (R96 spec). admission's tests hold the set to the table.

View Source
var Rungs = []string{"author", "full"}

Rungs is the value set of FieldRung: the stages of tutor's rule of admission of models, in tutor's codes (R25). admission's tests hold the set to config's.

Steps is every step of the daily job, in the order it takes them.

View Source
var TokenClasses = []string{"expired", "invalid", "revoked", "no_user", "disabled", "failed"}

TokenClasses is the value set of FieldTokenClass: the classes of a refused token, in authn's words (R20, R32).

Functions

func New

func New(w io.Writer, level slog.Leveler) *slog.Logger

New is the log of the process, writing to w the lines at level and above.

Types

type Kind

type Kind struct {
	// contains filtered or unexported fields
}

Kind names what an error or a panic is, and none of what it carries: its text may hold a path, an address, a value from a request. Only ErrorKind and PanicKind make one, and the table accepts no other value for the fields error_kind and panic_kind.

func ErrorKind

func ErrorKind(err error) Kind

ErrorKind names an error by its chain, outermost first: the type of each link, a sentinel of the standard library by its name, and an errno of the system in the system's own words, which hold no data. The text of any other link is not written, since an error made by fmt.Errorf holds whatever its author formatted into it.

func PanicKind

func PanicKind(recovered any) Kind

PanicKind names what a panic was raised with. A fault of the Go runtime is put in the runtime's own words, found inside whatever wrapped it, because those words hold types and numbers and no data. Anything else is a value of ours or a library's, which may hold a task, an answer or an image, so only its type is written.

func (Kind) LogValue

func (k Kind) LogValue() slog.Value

LogValue is what the log writes: the name.

func (Kind) String

func (k Kind) String() string

String is the kind's name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL