Help us shape the future of Go! Take the 2026 Go Developer Survey

logsender

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package logsender provides an omnimail.Sender that writes messages to a slog.Logger instead of delivering them. It is intended for local development. Bodies are redacted by default because transactional mail carries secrets such as verification links; enable them with WithBodies only where logs are private.

Index

Constants

View Source
const ProviderName = "log"

ProviderName is reported in SendResult.Provider.

View Source
const Redacted = "[redacted]"

Redacted replaces body content in log records unless WithBodies is set.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Sender)

Option configures a Sender.

func WithBodies

func WithBodies() Option

WithBodies logs the text and HTML bodies instead of redacting them.

func WithLevel

func WithLevel(l slog.Level) Option

WithLevel sets the log level (default slog.LevelInfo).

type Sender

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

Sender logs messages. It is safe for concurrent use.

func New

func New(logger *slog.Logger, opts ...Option) *Sender

New returns a Sender writing to logger, or slog.Default() when nil.

func (*Sender) Send

func (s *Sender) Send(ctx context.Context, msg *omnimail.Message) (*omnimail.SendResult, error)

Send validates msg and logs it as one record.

Jump to

Keyboard shortcuts

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