log

package module
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultFormat = `[%level%] %date% %time% (%file%) `
	DefaultFile   = `logs/application.log`
)
View Source
const (
	LevelAll = iota
	LevelDebug
	LevelInfo
	LevelWarn
	LevelError
	LevelFatal
)

Variables

This section is empty.

Functions

func D

func D(v ...interface{})

func DisableColor added in v0.6.0

func DisableColor(disable bool)

func E

func E(v ...interface{})

func F

func F(v ...interface{})

Equivalent to Print() followed by a call to os.Exit(1).

func Fatal added in v0.2.0

func Fatal(v ...interface{})

Equivalent to Print() followed by a call to os.Exit(1). Compatibility for built-in go logging library

func Fatalf added in v0.2.0

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

Equivalent to Printf() followed by a call to os.Exit(1). Compatibility for built-in go logging library

func Fatalln added in v0.2.0

func Fatalln(v ...interface{})

Alias for F() Compatibility for built-in go logging library

func I

func I(v ...interface{})

func Prefix added in v0.2.0

func Prefix() string

Return the output prefix for the standard logger.

func Print added in v0.2.0

func Print(v ...interface{})

Calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Print. Compatibility for built-in go logging library

func Printf added in v0.2.0

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

Calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Printf. Compatibility for built-in go logging library

func Println added in v0.2.0

func Println(v ...interface{})

Calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Println. Compatibility for built-in go logging library

func SetFile added in v0.2.0

func SetFile(file string)

func SetFormat added in v0.2.0

func SetFormat(format string)

func SetLevel

func SetLevel(level int)

func SetPrefix added in v0.2.0

func SetPrefix(prefix string)

Set the output prefix for the standard logger.

func Start added in v0.4.0

func Start(msg ...string) (func(...string), func())

func W

func W(v ...interface{})

Types

type Format added in v0.2.0

type Format struct {
	// contains filtered or unexported fields
}

type Frame added in v0.2.2

type Frame struct {
	File     string
	Dir      string
	Version  string
	Function string
	Line     int
}

func Stacktrace added in v0.2.1

func Stacktrace(skip int) []Frame

func (*Frame) String added in v0.2.2

func (f *Frame) String() string

type Logger

type Logger struct {
	Level int

	File string
	// contains filtered or unexported fields
}

func Default added in v0.2.0

func Default() *Logger

func New added in v0.2.0

func New() *Logger

func NewWithFile added in v0.3.0

func NewWithFile(filename string) *Logger

func NewWithFormat added in v0.3.0

func NewWithFormat(format string) *Logger

func (*Logger) D

func (l *Logger) D(v ...interface{})

func (*Logger) DisableColor added in v0.6.0

func (l *Logger) DisableColor(disable bool)

func (*Logger) E

func (l *Logger) E(v ...interface{})

func (*Logger) F

func (l *Logger) F(v ...interface{})

Equivalent to Print() followed by a call to os.Exit(1).

func (*Logger) Format added in v0.2.0

func (l *Logger) Format(level int) *Format

func (*Logger) I

func (l *Logger) I(v ...interface{})

func (*Logger) Prefix added in v0.2.0

func (l *Logger) Prefix() string

Return the output prefix for the logger.

func (*Logger) Print added in v0.2.0

func (l *Logger) Print(v ...interface{})

func (*Logger) Println added in v0.2.0

func (l *Logger) Println(v ...interface{})

func (*Logger) SetCallDepth added in v0.2.0

func (l *Logger) SetCallDepth(depth int)

func (*Logger) SetFile added in v0.2.0

func (l *Logger) SetFile(file string)

func (*Logger) SetFormat added in v0.2.0

func (l *Logger) SetFormat(format string)

func (*Logger) SetLevelFormat added in v0.2.0

func (l *Logger) SetLevelFormat(level int, format string)

func (*Logger) SetPrefix added in v0.2.0

func (l *Logger) SetPrefix(prefix string)

Set the output prefix for the logger.

func (*Logger) Start added in v0.5.0

func (l *Logger) Start(msg ...string) (func(...string), func())

Returns function to log and function to flush Flush have to be called after finish, better use defer to make sure function will be called

func (*Logger) W

func (l *Logger) W(v ...interface{})

type Session added in v0.4.0

type Session struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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