log

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

* Apache License 2.0 * * Copyright (c) 2022, Austin Zhai * All rights reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

func Debugf

func Debugf(format string, v ...interface{})

func Error

func Error(v ...interface{})

func Errorf

func Errorf(format string, v ...interface{})

func Fatal

func Fatal(v ...interface{})

func Fatalf

func Fatalf(format string, v ...interface{})

func Info

func Info(v ...interface{})

func Infof

func Infof(format string, v ...interface{})

func Printf

func Printf(level Level, format string, v ...interface{})

func Println

func Println(level Level, v ...interface{})

func SetFlags

func SetFlags(flag int)

func SetLevel

func SetLevel(level Level)

func SetOutput

func SetOutput(out io.Writer)

func Trace

func Trace(v ...interface{})

func Tracef

func Tracef(format string, v ...interface{})

func Warn

func Warn(v ...interface{})

func Warnf

func Warnf(format string, v ...interface{})

Types

type Level

type Level int
const (
	LevelNull  Level = 0
	LevelTrace Level = 1
	LevelDebug Level = 2
	LevelInfo  Level = 3
	LevelWarn  Level = 4
	LevelError Level = 5
	LevelFatal Level = 6
)

func ParseLevel

func ParseLevel(levelS string) (Level, error)

type Log

type Log struct {
	// contains filtered or unexported fields
}
var (
	DefaultLog *Log

	ErrUnsupportedLogLevel = errors.New("unsupported log level")
)

func NewLog

func NewLog() *Log

func WithFlags

func WithFlags(flag int) *Log

func WithLevel

func WithLevel(level Level) *Log

func WithOutput

func WithOutput(out io.Writer) *Log

func (*Log) Debug

func (log *Log) Debug(v ...interface{})

func (*Log) Debugf

func (log *Log) Debugf(format string, v ...interface{})

func (*Log) Error

func (log *Log) Error(v ...interface{})

func (*Log) Errorf

func (log *Log) Errorf(format string, v ...interface{})

func (*Log) Fatal

func (log *Log) Fatal(v ...interface{})

func (*Log) Fatalf

func (log *Log) Fatalf(format string, v ...interface{})

func (*Log) Info

func (log *Log) Info(v ...interface{})

func (*Log) Infof

func (log *Log) Infof(format string, v ...interface{})

func (*Log) Printf

func (log *Log) Printf(level Level, format string, v ...interface{})

func (*Log) Println

func (log *Log) Println(level Level, v ...interface{})

func (*Log) SetFlags

func (log *Log) SetFlags(flag int)

func (*Log) SetLevel

func (log *Log) SetLevel(level Level)

func (*Log) SetOutput

func (log *Log) SetOutput(out io.Writer)

func (*Log) Trace

func (log *Log) Trace(v ...interface{})

func (*Log) Tracef

func (log *Log) Tracef(format string, v ...interface{})

func (*Log) Warn

func (log *Log) Warn(v ...interface{})

func (*Log) Warnf

func (log *Log) Warnf(format string, v ...interface{})

func (*Log) WithFlags

func (log *Log) WithFlags(flag int) *Log

func (*Log) WithLevel

func (log *Log) WithLevel(level Level) *Log

func (*Log) WithOutput

func (log *Log) WithOutput(out io.Writer) *Log

type Logger

type Logger interface {
	Trace(v ...interface{})
	Tracef(format string, v ...interface{})
	Debug(v ...interface{})
	Debugf(format string, v ...interface{})
	Info(v ...interface{})
	Infof(format string, v ...interface{})
	Warn(v ...interface{})
	Warnf(format string, v ...interface{})
	Error(v ...interface{})
	Errorf(format string, v ...interface{})
}

Jump to

Keyboard shortcuts

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