Documentation ¶
Overview ¶
Package gcl provides a log/slog.Handler for Google Cloud Logging.
Index ¶
- Constants
- type Handler
- func (h *Handler) Close() error
- func (h *Handler) Enabled(_ context.Context, level slog.Level) bool
- func (h *Handler) Flush() error
- func (h *Handler) Handle(_ context.Context, r slog.Record) error
- func (h *Handler) Ping(ctx context.Context) error
- func (h *Handler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *Handler) WithGroup(name string) slog.Handler
Constants ¶
View Source
const ( FieldError = "error" FieldRequest = "request" FieldLatency = "latency" FieldResponseSize = "response_size" FieldRequestSize = "request_size" FieldResponseStatus = "response_status" FieldRemoteIP = "remote_ip" )
Common log fields.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a log/slog.Handler for GCP logging.
func New ¶
func New(ctx context.Context, project, logID string, level slog.Leveler, clientOpts ...option.ClientOption) (*Handler, error)
New returns a new GCP logging handler.
func (*Handler) Enabled ¶
Enabled returns true if level is at least to the configured minimum level.
Click to show internal directories.
Click to hide internal directories.