log

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package log simulates acceptance while logging only bounded message metadata. It does not deliver mail and never logs recipients, bodies, subjects or keys.

Index

Constants

View Source
const DefaultPreviewBytes = 64 << 10

DefaultPreviewBytes bounds each logged body.

Variables

This section is empty.

Functions

func RedactHeader

func RedactHeader(name, value string) string

RedactHeader reports the logged form of one header value.

Types

type Driver

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

Driver simulates email acceptance by logging message counts and size.

func New

func New(logger *slog.Logger) (*Driver, error)

New creates a logging driver, rejecting a nil logger.

func (*Driver) Send

func (d *Driver) Send(ctx context.Context, out email.Outbound) (email.Receipt, error)

Send logs counts and size to simulate acceptance without delivery.

type PreviewDriver

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

PreviewDriver is a development transport: it simulates acceptance and logs the rendered message (sender, recipients, subject, locale, headers, text and HTML bodies and attachment metadata) so developers can read mail without a provider. Header values whose names suggest credentials (authorization, token, secret, key, password, signature, cookie, session) are redacted and attachment bytes are never logged. It records private content: use it only in local and development environments.

func NewPreview

func NewPreview(logger *slog.Logger, maxBytes int) (*PreviewDriver, error)

NewPreview logs through logger; maxBytes bounds each body (zero selects DefaultPreviewBytes).

func (*PreviewDriver) Send

Send logs a preview with bounded bodies, redacted headers, and a BCC count, without delivering the message.

Jump to

Keyboard shortcuts

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