package gnet

import (
	"log"
	"os"
)

type Logger interface {
	Println(f string, v ...any)
}

type defaultLogger struct {
	lg *log.Logger
}

func (l *defaultLogger) Println(f string, v ...any) {
	l.lg.Printf(f, v...)
}

var (
	DefaultLogger = func(prefix string) Logger {
		return &defaultLogger{lg: log.New(os.Stdout, prefix, log.LstdFlags)}
	}
)

type noneLogger struct{}

func (n *noneLogger) Println(_ string, _ ...any) { return }

var (
	NoneLogger = &noneLogger{}
)
