New lint rules

This commit is contained in:
Jamie Curnow
2024-11-21 19:07:36 +10:00
parent 4e6d65645f
commit 152b7666d8
85 changed files with 385 additions and 259 deletions

View File

@ -71,17 +71,17 @@ func GetLogLevel() Level {
}
// Debug logs if the log level is set to DebugLevel or below. Arguments are handled in the manner of fmt.Printf.
func Debug(format string, args ...interface{}) {
func Debug(format string, args ...any) {
logger.Debug(format, args...)
}
// Info logs if the log level is set to InfoLevel or below. Arguments are handled in the manner of fmt.Printf.
func Info(format string, args ...interface{}) {
func Info(format string, args ...any) {
logger.Info(format, args...)
}
// Warn logs if the log level is set to WarnLevel or below. Arguments are handled in the manner of fmt.Printf.
func Warn(format string, args ...interface{}) {
func Warn(format string, args ...any) {
logger.Warn(format, args...)
}
@ -134,7 +134,7 @@ var logLevels = map[Level]string{
ErrorLevel: "ERROR",
}
func (l *Logger) logLevel(logLevel Level, format string, args ...interface{}) {
func (l *Logger) logLevel(logLevel Level, format string, args ...any) {
if logLevel < l.LogThreshold {
return
}
@ -146,7 +146,7 @@ func (l *Logger) logLevel(logLevel Level, format string, args ...interface{}) {
if len(args) > 1 {
args = args[1:]
} else {
args = []interface{}{}
args = []any{}
}
}
@ -202,17 +202,17 @@ func (l *Logger) GetLogLevel() Level {
}
// Debug logs if the log level is set to DebugLevel or below. Arguments are handled in the manner of fmt.Printf.
func (l *Logger) Debug(format string, args ...interface{}) {
func (l *Logger) Debug(format string, args ...any) {
l.logLevel(DebugLevel, format, args...)
}
// Info logs if the log level is set to InfoLevel or below. Arguments are handled in the manner of fmt.Printf.
func (l *Logger) Info(format string, args ...interface{}) {
func (l *Logger) Info(format string, args ...any) {
l.logLevel(InfoLevel, format, args...)
}
// Warn logs if the log level is set to WarnLevel or below. Arguments are handled in the manner of fmt.Printf.
func (l *Logger) Warn(format string, args ...interface{}) {
func (l *Logger) Warn(format string, args ...any) {
l.logLevel(WarnLevel, format, args...)
}