stdlog

package
v0.12.19 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StandardFormatter

func StandardFormatter(entry log.Entry, cfg log.BackendConfig, senderSpacing int, severitySpacing int) string

StandardFormatter prints a timestamp followed by sender, severity, and message.

Types

type StdLogBackend

type StdLogBackend struct {
	log.CommonBackend

	// Formatter generates the final string printed to stdlog.
	Formatter func(entry log.Entry, cfg log.BackendConfig, senderSpacing int, severitySpacing int) string
	// contains filtered or unexported fields
}

StdLogBackend writes entries to the standard library logger. Prefer configuring stdlog with SetFlags(0) for consistent output.

func (*StdLogBackend) NotifyAboutSender

func (loggy *StdLogBackend) NotifyAboutSender(sender string)

NotifyAboutSender tracks the widest sender name for padding.

func (*StdLogBackend) NotifyAboutSeverity

func (loggy *StdLogBackend) NotifyAboutSeverity(severity *log.Severity)

NotifyAboutSeverity tracks the widest severity label for padding.

func (*StdLogBackend) Shutdown

func (loggy *StdLogBackend) Shutdown()

Shutdown satisfies the Backend interface but stdlog has nothing to release.

func (*StdLogBackend) Write

func (loggy *StdLogBackend) Write(entry log.Entry) error

Write formats the entry and outputs it when it meets the gate.

Source Files

  • Backend.go
  • Compliance.go

Jump to

Keyboard shortcuts

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