Documentation
¶
Index ¶
- func C(msg string, scratch []byte)
- func D(msg string, args ...any)
- func D2(at int, msg string, args ...any)
- func E(msg string, args ...any)
- func E2(at int, msg string, args ...any)
- func EE(msg string, args ...any) (err error)
- func I(msg string, args ...any)
- func I2(at int, msg string, args ...any)
- func N(string, ...any)
- func N2(int, string, ...any)
- func NewLogger(tag string) *simpleLogger
- func P(msg string, args ...any)
- func R(c bool, msg string, args ...any)
- func SetConsole(consoleCtx context.Context, c Console)
- func SetConsoleLevel(level LogLevel)
- func SetLevel(level LogLevel)
- func T(msg string, args ...any)
- func TALL(msg string, atleast64k []byte)
- func U(msg string)
- func V(msg string, args ...any)
- func V2(at int, msg string, args ...any)
- func VV(msg string, args ...any)
- func VV2(at int, msg string, args ...any)
- func W(msg string, args ...any)
- func W2(at int, msg string, args ...any)
- func WE(msg string, args ...any) (err error)
- func Wtf(msg string, args ...any)
- type Console
- type FilebasedConsole
- type LogFn
- type LogFn2
- type LogLevel
- type Logger
- type Logmsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLogger ¶
func NewLogger(tag string) *simpleLogger
NewLogger creates a new Glogger with the given tag.
func SetConsole ¶
SetConsole sets external console to redirect log output to.
func SetConsoleLevel ¶
func SetConsoleLevel(level LogLevel)
Types ¶
type FilebasedConsole ¶
func NewFilebased ¶
func NewFilebased() (reader *os.File, writer FilebasedConsole, err error)
NewFilebased sets a pipe-backed console and returns reader and writer. Caller is expected to hand off the read fd and read until EOF. Caller owns the reader and write and must close both.
type LogLevel ¶
type LogLevel uint32
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. )
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)
Trace(c bool, t string)
Stack(at int, msg string, scratch []byte)
}
var Glogger Logger = defaultLogger()
based on: github.com/eycorsican/go-tun2socks/blob/301549c43/common/log/log.go#L5
Click to show internal directories.
Click to hide internal directories.