mirror of
https://github.com/hanzoai/go-openai-realtime.git
synced 2026-09-30 21:54:42 +00:00
feat: refine the Logger interface
This commit is contained in:
@@ -3,8 +3,10 @@ package openairt
|
||||
import "log"
|
||||
|
||||
type Logger interface {
|
||||
Errorf(format string, v ...any)
|
||||
Debugf(format string, v ...any)
|
||||
Infof(format string, v ...any)
|
||||
Warnf(format string, v ...any)
|
||||
Errorf(format string, v ...any)
|
||||
}
|
||||
|
||||
// NopLogger is a logger that does nothing.
|
||||
@@ -16,6 +18,12 @@ func (l NopLogger) Errorf(_ string, _ ...any) {}
|
||||
// Warnf does nothing.
|
||||
func (l NopLogger) Warnf(_ string, _ ...any) {}
|
||||
|
||||
// Infof does nothing.
|
||||
func (l NopLogger) Infof(_ string, _ ...any) {}
|
||||
|
||||
// Debugf does nothing.
|
||||
func (l NopLogger) Debugf(_ string, _ ...any) {}
|
||||
|
||||
// StdLogger is a logger that logs to the "log" package.
|
||||
type StdLogger struct{}
|
||||
|
||||
@@ -26,3 +34,11 @@ func (l StdLogger) Errorf(format string, v ...any) {
|
||||
func (l StdLogger) Warnf(format string, v ...any) {
|
||||
log.Printf("[WARN] "+format, v...)
|
||||
}
|
||||
|
||||
func (l StdLogger) Infof(format string, v ...any) {
|
||||
log.Printf("[INFO] "+format, v...)
|
||||
}
|
||||
|
||||
func (l StdLogger) Debugf(format string, v ...any) {
|
||||
log.Printf("[DEBUG] "+format, v...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user