telelog

package
v0.3.106 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package telelog provides a queued, ISO 8601 UTC logger for all Tela binaries.

Log lines are written to a channel and consumed by a low-priority background goroutine, minimizing the impact of logging on runtime performance. Lines are still captured in order because the channel is unbuffered reads happen in FIFO order from a buffered channel.

Usage:

telelog.Init("tela", os.Stderr)   // call once at startup
log.Println("hello")             // uses standard log, routed through telelog
telelog.Flush()                   // call before exit to drain the queue

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectWriter

func DirectWriter() io.Writer

DirectWriter returns an io.Writer that writes directly to the output without going through the queue. Use for the underlying output when other writers need to tee.

func Flush

func Flush()

Flush blocks until all queued log lines have been written. Call before exit.

func Init

func Init(pfx string, out io.Writer)

Init configures the global logger to use queued, ISO 8601 UTC output. prefix is the component name (e.g., "tela", "telad", "mount"). out is the output destination (typically os.Stderr). Call this once at the start of main before any logging.

func NewLogger

func NewLogger(pfx string, out io.Writer) *log.Logger

NewLogger creates a log.Logger with a different prefix that routes through the same queue. Use this for per-component loggers (e.g., per-machine in telad).

func SetOutput

func SetOutput(w io.Writer)

SetOutput changes the output destination for the queue drainer. Use this to redirect log output (e.g., to a tee writer that captures output for a control API while still writing to stderr).

func WrapOutput

func WrapOutput(extra io.Writer) io.Writer

WrapOutput returns an io.Writer that tees to both the log queue and the given writer. Use this for the tela control log capture (which needs to capture output to a buffer AND route through the queue).

func Writer

func Writer() io.Writer

Writer returns an io.Writer that writes to the log queue with the default prefix. Useful for redirecting other output (e.g., log files) through the queue.

Types

This section is empty.

Jump to

Keyboard shortcuts

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