package log

import (
	
	
	
	
	
	

	
)

var _ AllLogger = (*defaultLogger)(nil)

type defaultLogger struct {
	stdlog *log.Logger
	level  Level
	depth  int
}

// privateLog logs a message at a given level log the default logger.
// when the level is fatal, it will exit the program.
func ( *defaultLogger) ( Level,  []interface{}) {
	if .level >  {
		return
	}
	 := .toString()
	 := bytebufferpool.Get()
	_, _ = .WriteString()                  //nolint:errcheck // It is fine to ignore the error
	_, _ = .WriteString(fmt.Sprint(...)) //nolint:errcheck // It is fine to ignore the error

	_ = .stdlog.Output(.depth, .String()) //nolint:errcheck // It is fine to ignore the error
	.Reset()
	bytebufferpool.Put()
	if  == LevelFatal {
		os.Exit(1) //nolint:revive // we want to exit the program when Fatal is called
	}
}

// privateLog logs a message at a given level log the default logger.
// when the level is fatal, it will exit the program.
func ( *defaultLogger) ( Level,  string,  []interface{}) {
	if .level >  {
		return
	}
	 := .toString()
	 := bytebufferpool.Get()
	_, _ = .WriteString() //nolint:errcheck // It is fine to ignore the error

	if len() > 0 {
		_, _ = fmt.Fprintf(, , ...)
	} else {
		_, _ = fmt.Fprint(, ...)
	}
	_ = .stdlog.Output(.depth, .String()) //nolint:errcheck // It is fine to ignore the error
	.Reset()
	bytebufferpool.Put()
	if  == LevelFatal {
		os.Exit(1) //nolint:revive // we want to exit the program when Fatal is called
	}
}

// privateLogw logs a message at a given level log the default logger.
// when the level is fatal, it will exit the program.
func ( *defaultLogger) ( Level,  string,  []interface{}) {
	if .level >  {
		return
	}
	 := .toString()
	 := bytebufferpool.Get()
	_, _ = .WriteString() //nolint:errcheck // It is fine to ignore the error

	// Write format privateLog buffer
	if  != "" {
		_, _ = .WriteString() //nolint:errcheck // It is fine to ignore the error
	}
	var  sync.Once
	 := true
	// Write keys and values privateLog buffer
	if len() > 0 {
		if (len() & 1) == 1 {
			 = append(, "KEYVALS UNPAIRED")
		}

		for  := 0;  < len();  += 2 {
			if  == "" &&  {
				.Do(func() {
					_, _ = fmt.Fprintf(, "%s=%v", [], [+1])
					 = false
				})
				continue
			}
			_, _ = fmt.Fprintf(, " %s=%v", [], [+1])
		}
	}

	_ = .stdlog.Output(.depth, .String()) //nolint:errcheck // It is fine to ignore the error
	.Reset()
	bytebufferpool.Put()
	if  == LevelFatal {
		os.Exit(1) //nolint:revive // we want to exit the program when Fatal is called
	}
}

func ( *defaultLogger) ( ...interface{}) {
	.privateLog(LevelTrace, )
}

func ( *defaultLogger) ( ...interface{}) {
	.privateLog(LevelDebug, )
}

func ( *defaultLogger) ( ...interface{}) {
	.privateLog(LevelInfo, )
}

func ( *defaultLogger) ( ...interface{}) {
	.privateLog(LevelWarn, )
}

func ( *defaultLogger) ( ...interface{}) {
	.privateLog(LevelError, )
}

func ( *defaultLogger) ( ...interface{}) {
	.privateLog(LevelFatal, )
}

func ( *defaultLogger) ( ...interface{}) {
	.privateLog(LevelPanic, )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogf(LevelTrace, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogf(LevelDebug, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogf(LevelInfo, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogf(LevelWarn, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogf(LevelError, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogf(LevelFatal, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogf(LevelPanic, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogw(LevelTrace, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogw(LevelDebug, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogw(LevelInfo, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogw(LevelWarn, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogw(LevelError, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogw(LevelFatal, , )
}

func ( *defaultLogger) ( string,  ...interface{}) {
	.privateLogw(LevelPanic, , )
}

func ( *defaultLogger) ( context.Context) CommonLogger {
	return &defaultLogger{
		stdlog: .stdlog,
		level:  .level,
		depth:  .depth - 1,
	}
}

func ( *defaultLogger) ( Level) {
	.level = 
}

func ( *defaultLogger) ( io.Writer) {
	.stdlog.SetOutput()
}

// DefaultLogger returns the default logger.
func () AllLogger {
	return logger
}