log

package
v0.0.0-...-1e8709c Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CallerDepth = 4

caller -> intra/log.go (this file) -> intra/logger.go -> golang/log.go

View Source
var LogFnCallerDepth = CallerDepth + 1

caller -> LogFn -> intra/log.go (this file) -> intra/logger.go -> golang/log.go

Functions

func C

func C(msg string, scratch []byte)

C logs the stack trace of the current goroutine to Console.

func D

func D(msg string, args ...any)

func D2

func D2(at int, msg string, args ...any)

func E

func E(msg string, args ...any)

func E2

func E2(at int, msg string, args ...any)

func I

func I(msg string, args ...any)

func I2

func I2(at int, msg string, args ...any)

func N

func N(string, ...any)

func N2

func N2(int, string, ...any)

func NewLogger

func NewLogger(tag string) *simpleLogger

NewLogger creates a new Glogger with the given tag.

func P

func P(msg string, args ...any)

func RegisterLogger

func RegisterLogger(l Logger) bool

func SetConsole

func SetConsole(c Console)

func SetConsoleLevel

func SetConsoleLevel(level LogLevel)

func SetLevel

func SetLevel(level LogLevel)

func T

func T(msg string, scratch []byte)

T logs the stack trace of the current goroutine.

func U

func U(msg string)

func V

func V(msg string, args ...any)

func V2

func V2(at int, msg string, args ...any)

func VV

func VV(msg string, args ...any)

func VV2

func VV2(at int, msg string, args ...any)

func W

func W(msg string, args ...any)

func W2

func W2(at int, msg string, args ...any)

func Wtf

func Wtf(msg string, args ...any)

Types

type Console

type Console interface {
	// Log logs a multi-line msg.
	Log(level int32, msg string)
}

Console is an external logger.

type LogFn

type LogFn func(string, ...any)

func Of

func Of(tag string, l LogFn2) LogFn

type LogFn2

type LogFn2 func(int, string, ...any)

type LogLevel

type LogLevel uint32

based on: github.com/eycorsican/go-tun2socks/blob/301549c43/common/log/logger.go

const (
	VVERBOSE   LogLevel = iota // VVERBOSE is the most verbose log level.
	VERBOSE                    // VERBOSE is the verbose log level.
	DEBUG                      // DEBUG is the debug log level.
	INFO                       // INFO is the informational log level.
	WARN                       // WARN is the warning log level.
	ERROR                      // ERROR is the error log level.
	STACKTRACE                 // STACKTRACE is the stack trace log level.
	USR                        // USR is interactive log (e.g. as user prompt).
	NONE                       // NONE no-ops the logger.
)

func LevelOf

func LevelOf(level int32) LogLevel

type Logger

type Logger interface {
	SetLevel(level LogLevel)
	SetConsoleLevel(level LogLevel)
	SetConsole(c Console)
	Usr(msg string)
	Printf(msg string, args ...any)
	VeryVerbosef(at int, msg string, args ...any)
	Verbosef(at int, msg string, args ...any)
	Debugf(at int, msg string, args ...any)
	Piif(at int, msg string, args ...any)
	Infof(at int, msg string, args ...any)
	Warnf(at int, msg string, args ...any)
	Errorf(at int, msg string, args ...any)
	Fatalf(at int, msg string, args ...any)
	Stack(at int, msg string, scratch []byte)
}
var Glogger Logger

based on: github.com/eycorsican/go-tun2socks/blob/301549c43/common/log/log.go#L5

Jump to

Keyboard shortcuts

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