Documentation
¶
Overview ¶
Package daemonlog holds the logger and shutdown handling the dispatcher and executor daemons share, so both report the same way.
Index ¶
- func Diagnostic(err error) string
- func Identifier(value string) string
- func New(level string, jsonLogs bool) *zap.Logger
- func RequestID(ctx context.Context) string
- func Run(logger *zap.Logger, role string, run func(context.Context) error) error
- func RunFields(ctx context.Context, id uuid.UUID, executorID string, ...) []zap.Field
- func SessionFields(executorID string, binding controlsession.Binding) []zap.Field
- func StreamErrors(logger *zap.Logger) grpc.StreamServerInterceptor
- func UnaryErrors(logger *zap.Logger) grpc.UnaryServerInterceptor
- func UploadFailureFields(ctx context.Context, stage string, err error, elapsed time.Duration) []zap.Field
- func WithRequestID(ctx context.Context, id uuid.UUID) context.Context
- func YamuxConfig(logger *zap.Logger) *yamux.Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diagnostic ¶
Diagnostic is bounded, single-line text for the opt-in private Debug sink. Callers redact known credentials before using it; it is not a secret detector.
func Identifier ¶
Identifier keeps non-secret identifiers bounded and safe in text logs too. Oversized or non-printable identifiers use a stable digest, not a prefix that could make two different executors appear to be the same one.
func New ¶
New builds a daemon logger that writes to stdout without stack traces. It uses zap's development encoding, or its JSON production encoding when jsonLogs is set. A level zap cannot parse falls back to info; the daemons' configuration loaders reject such a level before this is reached.
func Run ¶
Run calls run with a context that SIGINT or SIGTERM cancels. When a signal arrives it logs, once and tagged with role, that shutdown was requested, and it returns only after that notice is written, so the notice always precedes whatever the caller logs about how the daemon stopped.
func RunFields ¶
func RunFields(ctx context.Context, id uuid.UUID, executorID string, binding controlsession.Binding) []zap.Field
RunFields joins HTTP and dispatcher events through request_id, and dispatcher and executor events through the run and control binding. No durable attempt identity is currently available; absence is not evidence of a first attempt.
func SessionFields ¶
func SessionFields(executorID string, binding controlsession.Binding) []zap.Field
func StreamErrors ¶
func StreamErrors(logger *zap.Logger) grpc.StreamServerInterceptor
func UnaryErrors ¶
func UnaryErrors(logger *zap.Logger) grpc.UnaryServerInterceptor
func UploadFailureFields ¶
func UploadFailureFields(ctx context.Context, stage string, err error, elapsed time.Duration) []zap.Field
UploadFailureFields records the boundary that failed, not a guessed root cause or admission outcome. Stage is a constant from the upload handler; error text and request contents must not be included in these normal logs.
func WithRequestID ¶
WithRequestID attaches a server-generated identifier to local request work.
Types ¶
This section is empty.