logsafe

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package logsafe scrubs request payloads before they reach a log sink or a trace tag.

Three things happen and the order matters: file content is replaced, then the credentials a pre-signed storage URL carries, then what survives is capped. Truncation alone is not enough, because base64 usually leads the arguments object: the retained head would be the readable start of the file, and the tool name and other parameters would be what got cut.

Index

Constants

View Source
const MaxLoggedBytes = 64 << 10

MaxLoggedBytes caps a scrubbed payload. It matches the cap the response writer already applies, so inbound and outbound bodies are treated alike.

Variables

This section is empty.

Functions

func Bytes

func Bytes(b []byte) []byte

Bytes returns b with file content and pre-signed URL credentials replaced, and the result capped.

func ElidedBody

func ElidedBody(length int64, contentType string) string

ElidedBody is the placeholder logged in place of a body that is not worth capturing.

func IsTextualContentType

func IsTextualContentType(contentType string) bool

IsTextualContentType reports whether a body of this content type is worth capturing in a log. A pending file upload sends raw bytes, and capturing them would copy the customer's file into the log and hold a second copy in memory for the life of the request.

func String

func String(s string) string

String is Bytes over a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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