2021-11-13 11:29:08 +00:00
package logger
import (
"os"
"sync"
)
var (
instance * Logger
instanceOnce = sync . Once { }
)
2021-11-27 14:26:58 +00:00
// Default returns the default Logger instance.
2021-11-13 11:29:08 +00:00
func Default ( ) * Logger {
instanceOnce . Do ( func ( ) { instance = New ( os . Stdout ) } )
return instance
}
2021-11-27 14:26:58 +00:00
// Debug prints the provided arguments with the debug prefix to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Debug ( a ... interface { } ) {
Default ( ) . Debug ( a ... )
}
2021-11-27 14:26:58 +00:00
// Debugf prints the provided format string and arguments with the debug prefix to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Debugf ( s string , a ... interface { } ) {
Default ( ) . Debugf ( s , a ... )
}
2021-11-27 14:26:58 +00:00
// Info prints the provided arguments with the info prefix to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Info ( a ... interface { } ) {
Default ( ) . Info ( a ... )
}
2021-11-27 14:26:58 +00:00
// Infof prints the provided format string and arguments with the info prefix to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Infof ( s string , a ... interface { } ) {
Default ( ) . Infof ( s , a ... )
}
2021-11-27 14:26:58 +00:00
// Warn prints the provided arguments with the warn prefix to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Warn ( a ... interface { } ) {
Default ( ) . Warn ( a ... )
}
2021-11-27 14:26:58 +00:00
// Warnf prints the provided format string and arguments with the warn prefix to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Warnf ( s string , a ... interface { } ) {
Default ( ) . Warnf ( s , a ... )
}
2021-11-27 14:26:58 +00:00
// Error prints the provided arguments with the error prefix to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Error ( a ... interface { } ) {
Default ( ) . Error ( a ... )
}
2021-11-27 14:26:58 +00:00
// Errorf prints the provided format string and arguments with the error prefix to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Errorf ( s string , a ... interface { } ) {
Default ( ) . Errorf ( s , a ... )
}
2021-11-27 14:26:58 +00:00
// Fatal prints the provided arguments with the fatal prefix to the global Logger instance before exiting the program with os.Exit(1).
2021-11-13 11:29:08 +00:00
func Fatal ( a ... interface { } ) {
Default ( ) . Fatal ( a ... )
}
2021-11-27 14:26:58 +00:00
// Fatalf prints the provided format string and arguments with the fatal prefix to the global Logger instance before exiting the program with os.Exit(1).
2021-11-13 11:29:08 +00:00
func Fatalf ( s string , a ... interface { } ) {
Default ( ) . Fatalf ( s , a ... )
}
2021-11-27 14:26:58 +00:00
// Log prints the provided arguments with the supplied log level to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Log ( lvl LEVEL , a ... interface { } ) {
Default ( ) . Log ( lvl , a ... )
}
2021-11-27 14:26:58 +00:00
// Logf prints the provided format string and arguments with the supplied log level to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Logf ( lvl LEVEL , s string , a ... interface { } ) {
Default ( ) . Logf ( lvl , s , a ... )
}
2021-11-27 14:26:58 +00:00
// Print simply prints provided arguments to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Print ( a ... interface { } ) {
Default ( ) . Print ( a ... )
}
2021-11-27 14:26:58 +00:00
// Printf simply prints provided the provided format string and arguments to the global Logger instance.
2021-11-13 11:29:08 +00:00
func Printf ( s string , a ... interface { } ) {
Default ( ) . Printf ( s , a ... )
}