logx

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package logx is the library's diagnostics sink: a leveled, zero-dependency logger writing to stderr. The default level is Info; the dispatcher picks up --xyz.log-level (code-side: logx.SetLevel).

The library only ever writes diagnostics here — command results and usage errors stay on their own output/error streams and are unaffected by the log level.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

func Debugf(format string, a ...any)

Debugf logs at debug level.

func Enabled

func Enabled(l Level) bool

Enabled reports whether messages at level l would be printed.

func Errorf

func Errorf(format string, a ...any)

Errorf logs at error level.

func Infof

func Infof(format string, a ...any)

Infof logs at info level.

func SetLevel

func SetLevel(l Level)

SetLevel sets the process-wide verbosity level.

func Warnf

func Warnf(format string, a ...any)

Warnf logs at warn level.

Types

type Level

type Level int32

Level is a verbosity level. Higher = quieter.

const (
	// LevelUnset 排在 0 位:它是 Config.LogLevel 的 Go 零值,语义为「保持默认」。
	LevelUnset Level = iota
	// LevelDebug enables dispatch/negotiation tracing (handy for MCP).
	LevelDebug
	// LevelInfo is the default: startup notices, mode chosen.
	LevelInfo
	// LevelWarn keeps warnings only (disabled channels, unprotected transports).
	LevelWarn
	// LevelError keeps error diagnostics only.
	LevelError
)

func ParseLevel

func ParseLevel(s string) (Level, error)

ParseLevel maps a flag value ("debug"|"info"|"warn"|"error") to a Level.

func (Level) String

func (l Level) String() string

Jump to

Keyboard shortcuts

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