blank

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package blank provides a Transport that delegates SendToLogger to a user-supplied function. It is useful for prototyping a new transport inline without creating a full package, for one-off integrations (forward to a metrics system, a queue, etc.), and for tests that need to inspect raw TransportParams without writing a TestTransport setup.

If you find yourself reusing the same blank.Config in multiple places, promote it to its own transport package; see /transports/creating-transports.md for the full template.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	transport.BaseConfig

	// ShipToLogger is invoked for every entry that passes the transport's
	// level filter. If nil, entries are silently discarded (which makes a
	// nil-ShipToLogger Transport a useful no-op for tests).
	//
	// Panics in ShipToLogger are not recovered by this transport. If your
	// callback can panic, recover inside it; otherwise the panic
	// propagates to the dispatching goroutine.
	ShipToLogger func(params loglayer.TransportParams)
}

Config holds configuration for the blank transport.

type Transport

type Transport struct {
	transport.BaseTransport
	// contains filtered or unexported fields
}

Transport delegates dispatch to the configured ShipToLogger function.

func New

func New(cfg Config) *Transport

New creates a blank Transport from the given Config.

func (*Transport) GetLoggerInstance

func (t *Transport) GetLoggerInstance() any

GetLoggerInstance returns nil; blank has no underlying library.

func (*Transport) SendToLogger

func (t *Transport) SendToLogger(params loglayer.TransportParams)

SendToLogger implements loglayer.Transport. Calls ShipToLogger if set; otherwise the entry is dropped after the level filter.

Jump to

Keyboard shortcuts

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