Documentation
¶
Index ¶
- func RegisterHook(hook Hook)
- func RemoveHook(hook Hook)
- type Hook
- type Logger
- func (logger *Logger) Close()
- func (logger *Logger) Flush()
- func (logger *Logger) Fork(ns string) (r *Logger)
- func (logger *Logger) Printf(format string, args ...any) (n int, err error)
- func (logger *Logger) Stderr() io.Writer
- func (logger *Logger) Stdout() io.Writer
- func (logger *Logger) Sync()
- func (logger *Logger) Tail(numLines int, stream Stream) (out []string, err error)
- func (logger *Logger) WithContext(ctx context.Context) context.Context
- type Options
- type Stream
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHook ¶
func RegisterHook(hook Hook)
func RemoveHook ¶
func RemoveHook(hook Hook)
Types ¶
type Hook ¶
type Hook interface { // Called when a logger is writing a line. // The line is already formatted. Write(ns string, line string, kind Stream) }
Hooking system to inject listeners into all loggers.
type Logger ¶
type Logger struct { Handles [StreamMax]*os.File Paths [StreamMax]string Opened Stream Timestamp string Namespace string PfxWidth int // contains filtered or unexported fields }
func FromContext ¶
type Options ¶
type Options struct { Output string `json:"stdout,omitempty"` // The file to which to redirect stdout, "null" to discard. Error string `json:"stderr,omitempty"` // The file to which to redirect stderr, "null" to discard, "merge" to redirect to stdout. LogTime string `json:"log_time,omitempty"` // The format to use for timestamps. LogName string `json:"log_name,omitempty"` // The name to prepend to log lines. PfxWidth int `json:"pfx_width,omitempty"` // The width of the prefix. }
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer type to wrap an io.Writer with the processing.
func (*Writer) WritePrefix ¶
func (f *Writer) WritePrefix()
Click to show internal directories.
Click to hide internal directories.