Documentation ¶
Index ¶
- func Debug(v ...any)
- func Debugf(format string, v ...any)
- func Debugln(v ...any)
- func DisableDebug()
- func EnableDebug()
- func Fatal(v ...any)
- func Fatalf(format string, v ...any)
- func Fatalln(v ...any)
- func Output(calldepth int, s string) error
- func Panic(v ...any)
- func Panicf(format string, v ...any)
- func Panicln(v ...any)
- func Print(v ...any)
- func Printf(format string, v ...any)
- func Println(v ...any)
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(v ...any)
Debug prints with "[DEBUG] " prefix when in the debug mode. Arguments are handled in the manner of fmt.Print.
func Debugf ¶
Debugf prints with "[DEBUG] " prefix when in the debug mode. Arguments are handled in the manner of fmt.Printf.
func Debugln ¶
func Debugln(v ...any)
Debugln prints with "[DEBUG] " prefix when in the debug mode. Arguments are handled in the manner of fmt.Println.
func DisableDebug ¶
func DisableDebug()
DisableDebug disables the debug log mode and has higher priority than DEBUG environment variable.
func EnableDebug ¶
func EnableDebug()
EnableDebug enables the debug log mode and has higher priority than DEBUG environment variable.
func Fatal ¶ added in v0.2.1
func Fatal(v ...any)
Fatal is equivalent to Print() followed by a call to os.Exit(1).
func Fatalln ¶ added in v0.2.1
func Fatalln(v ...any)
Fatalln is equivalent to Println() followed by a call to os.Exit(1).
func Output ¶ added in v0.2.1
Output writes the output for a logging event. The string s contains the text to print after the prefix specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline. Calldepth is the count of the number of frames to skip when computing the file name and line number if Llongfile or Lshortfile is set; a value of 1 will print the details for the caller of Output.
func Panic ¶ added in v0.2.1
func Panic(v ...any)
Panic is equivalent to Print() followed by a call to panic().
func Panicln ¶ added in v0.2.1
func Panicln(v ...any)
Panicln is equivalent to Println() followed by a call to panic().
func Print ¶ added in v0.2.1
func Print(v ...any)
Print calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Print.
Types ¶
type Logger ¶
A Logger is a standard log.Logger with Debug family functions.
func New ¶
func New() *Logger
New creates a new Logger and enables the debug log mode when found DEBUG environment variable set to one of the following values:
- yes
- true
- 1
func (*Logger) Debug ¶
Debug prints with "[DEBUG] " prefix when in the debug mode. Arguments are handled in the manner of fmt.Print.
func (*Logger) Debugf ¶
Debugf prints with "[DEBUG] " prefix when in the debug mode. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Debugln ¶
Debugln prints with "[DEBUG] " prefix when in the debug mode. Arguments are handled in the manner of fmt.Println.
func (*Logger) DisableDebug ¶
func (l *Logger) DisableDebug()
DisableDebug disables the debug log mode and has higher priority than DEBUG environment variable.
func (*Logger) EnableDebug ¶
func (l *Logger) EnableDebug()
EnableDebug enables the debug log mode and has higher priority than DEBUG environment variable.