ulog

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

README

ulog

Go Reference License Build

ulog is a simple and efficient level logging library for Go

Getting Started

The ulog package can be added to a project with go get.

go get cattlecloud.net/go/ulog@latest
Examples
log := ulog.New("my/component")
log.E.Fmt("the level is %s", "error")
log.W.Fmt("the level is %s", "warn")
log.I.Fmt("the level is %s", "info")
log.D.Fmt("the level is %s", "debug")
log.T.Fmt("the level is %s", "trace")
License

The cattlecloud.net/go/ulog module is open source under the BSD-3-Clause license.

Documentation

Overview

Package ulog provides a lightweight and efficient leveled logging library for Go.

Index

Constants

View Source
const (
	Error = iota
	Warn
	Info
	Debug
	Trace
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

type Log struct {
	E Output // error logs
	W Output // warn logs
	I Output // info logs
	D Output // debug logs
	T Output // trace logs
	// contains filtered or unexported fields
}

func New

func New(name string, opts ...Option) *Log

type Option

type Option func(l *Log)

func SetLevel

func SetLevel(value int) Option

type Output

type Output interface {
	Fmt(string, ...any)
}

Jump to

Keyboard shortcuts

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