whatsmeowgo.mau.fi/whatsmeow/util/log Index | Files

package waLog

import "go.mau.fi/whatsmeow/util/log"

Package waLog contains a simple logger interface used by the other whatsmeow packages.

Index

Types

type Logger

type Logger interface {
	Warnf(msg string, args ...interface{})
	Errorf(msg string, args ...interface{})
	Infof(msg string, args ...interface{})
	Debugf(msg string, args ...interface{})
	Sub(module string) Logger
}

Logger is a simple logger interface that can have subloggers for specific areas.

var Noop Logger = &noopLogger{}

Noop is a no-op Logger implementation that silently drops everything.

func Stdout

func Stdout(module string, minLevel string, color bool) Logger

Stdout is a simple Logger implementation that outputs to stdout. The module name given is included in log lines.

minLevel specifies the minimum log level to output. An empty string will output all logs.

If color is true, then info, warn and error logs will be colored cyan, yellow and red respectively using ANSI color escape codes.

func Zerolog

func Zerolog(log zerolog.Logger) Logger

Zerolog wraps a zerolog.Logger to implement the Logger interface.

Subloggers will be created by setting the `sublogger` field in the log context.

Source Files

log.go zerolog.go

Version
v0.0.0-20250326122532-6680c9a6e9a7 (latest)
Published
Mar 26, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
5 hours ago

Tools for package owners.