docs: add godoc and bilingual README
This commit is contained in:
15
io.go
15
io.go
@@ -5,55 +5,70 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// Infof logs a formatted info message.
|
||||
func (l *Logger) Infof(format string, args ...any) {
|
||||
l.print(INFO, fmt.Sprintf(format, args...))
|
||||
}
|
||||
// Info logs an info message.
|
||||
func (l *Logger) Info(m ...any) {
|
||||
l.print(INFO, m...)
|
||||
}
|
||||
// Infoln logs an info message and appends a newline semantic for writers that need it.
|
||||
func (l *Logger) Infoln(m ...any) {
|
||||
l.println(INFO, m...)
|
||||
}
|
||||
|
||||
// Warnf logs a formatted warning message.
|
||||
func (l *Logger) Warnf(format string, args ...any) {
|
||||
l.print(WARN, fmt.Sprintf(format, args...))
|
||||
}
|
||||
// Warn logs a warning message.
|
||||
func (l *Logger) Warn(m ...any) {
|
||||
l.print(WARN, m...)
|
||||
}
|
||||
// Warnln logs a warning message with newline semantic.
|
||||
func (l *Logger) Warnln(m ...any) {
|
||||
l.println(WARN, m...)
|
||||
}
|
||||
|
||||
// Errorf logs a formatted error message.
|
||||
func (l *Logger) Errorf(format string, args ...any) {
|
||||
l.print(ERROR, fmt.Sprintf(format, args...))
|
||||
}
|
||||
// Error logs an error message.
|
||||
func (l *Logger) Error(m ...any) {
|
||||
l.print(ERROR, m...)
|
||||
}
|
||||
// Errorln logs an error message with newline semantic.
|
||||
func (l *Logger) Errorln(m ...any) {
|
||||
l.println(ERROR, m...)
|
||||
}
|
||||
|
||||
// Fatalf logs a formatted fatal message and exits the process with code 1.
|
||||
func (l *Logger) Fatalf(format string, args ...any) {
|
||||
l.print(FATAL, fmt.Sprintf(format, args...))
|
||||
os.Exit(1)
|
||||
}
|
||||
// Fatal logs a fatal message and exits the process with code 1.
|
||||
func (l *Logger) Fatal(m ...any) {
|
||||
l.print(FATAL, m...)
|
||||
os.Exit(1)
|
||||
}
|
||||
// Fatalln logs a fatal message with newline semantic and exits the process with code 1.
|
||||
func (l *Logger) Fatalln(m ...any) {
|
||||
l.println(FATAL, m...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Debugf logs a formatted debug message.
|
||||
func (l *Logger) Debugf(format string, args ...any) {
|
||||
l.print(DEBUG, fmt.Sprintf(format, args...))
|
||||
}
|
||||
// Debug logs a debug message.
|
||||
func (l *Logger) Debug(m ...any) {
|
||||
l.print(DEBUG, m...)
|
||||
}
|
||||
// Debugln logs a debug message with newline semantic.
|
||||
func (l *Logger) Debugln(m ...any) {
|
||||
l.println(DEBUG, m...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user