logutil

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logutil provides structured logger constructors for daemon and local (stderr) logging.

Index

Constants

View Source
const TimestampFormat = "2006-01-02T15:04:05.000Z"

Variables

This section is empty.

Functions

func NewJSONLogger

func NewJSONLogger(w io.Writer, verbose bool) *slog.Logger

NewJSONLogger returns a *slog.Logger writing structured JSON to w. Used for daemon file logs; JSON format is Loki/Promtail-compatible.

func NewTextLogger

func NewTextLogger(w io.Writer, verbose bool) *slog.Logger

NewTextLogger returns a *slog.Logger writing human-readable text to w. Used for local (no-daemon) mode where output goes to a terminal.

Types

type TimestampWriter

type TimestampWriter struct {
	W io.Writer
	// contains filtered or unexported fields
}

TimestampWriter wraps an io.Writer and prepends an ISO 8601 timestamp to each line before passing it through.

func (*TimestampWriter) Write

func (tw *TimestampWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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