Files
bunny-bot/internal/mylog/types.go
eleksir 0c34b6e781 Global code ovehaul - remove CAS and other, add 15 minute greet check
- Remove CAS, as it no longer works for us
- Remove other checks
- Implement 15 minute greet timeout check
- Fix chat logos
- Ditch thirdparty logger, use stdlib log facility wrapper for logging
2026-10-20 12:20:16 +03:00

44 lines
1.3 KiB
Go

package mylog
// Types only. The level constants, the name table and Level.name live in
// globals.go and level.go respectively, because a file named "types" must hold
// nothing that is not a type.
import (
"io"
stdlog "log"
"os"
)
// Level is the severity of a log message. Levels are ordered, and a message is
// written when its own level is at or above the configured level.
type Level int
// stdLogger is the standard library logger doing the actual writing.
type stdLogger = stdlog.Logger
// Logger is the interface for modules that would otherwise depend on the
// standard library's *log.Logger. It is deliberately the smallest method set
// that *log.Logger satisfies, so widening a module's parameter type from
// *log.Logger to Logger keeps existing callers compiling.
type Logger interface {
Output(calldepth int, s string) error
}
// adapter is the Logger handed to such modules. Messages arrive through
// Output and are logged at debug level into the already-open destination.
type adapter struct{}
// state is everything the logger needs to write a line. It is held behind a
// lock so that a concurrent Init cannot close a destination mid-write.
type state struct {
level Level
dest io.Writer
slog *stdLogger
path string
owned *os.File
closed bool
}
/* vim: set ft=go noet ai ts=4 sw=4 sts=4: */