No need for Close to be part of the Logger interface

This commit is contained in:
Brian Picciano 2024-10-29 13:44:08 +01:00
parent 5660a9a623
commit 55bc7097f7
2 changed files with 1 additions and 7 deletions

View File

@ -25,7 +25,6 @@ const (
type Logger interface { type Logger interface {
Println(string) Println(string)
Printf(string, ...interface{}) Printf(string, ...interface{})
Close() error
} }
// NullLogger is an implementation of Logger which doesn't do anything. // NullLogger is an implementation of Logger which doesn't do anything.
@ -35,7 +34,6 @@ var _ Logger = NullLogger{}
func (NullLogger) Println(string) {} func (NullLogger) Println(string) {}
func (NullLogger) Printf(string, ...interface{}) {} func (NullLogger) Printf(string, ...interface{}) {}
func (NullLogger) Close() error { return nil }
// PlainLogger implements Logger by writing each line directly to the given // PlainLogger implements Logger by writing each line directly to the given
// io.Writer as-is. // io.Writer as-is.
@ -53,10 +51,6 @@ func (l PlainLogger) Printf(str string, args ...interface{}) {
fmt.Fprintf(l, str, args...) fmt.Fprintf(l, str, args...)
} }
func (l PlainLogger) Close() error {
return l.WriteCloser.Close()
}
// PmuxLogger is used by the pmux process itself for logging. It can prefix log // PmuxLogger is used by the pmux process itself for logging. It can prefix log
// lines with a timestamp, the name of the process being logged, and a custom // lines with a timestamp, the name of the process being logged, and a custom
// separator in front of the log line to help delineate one kind of log from // separator in front of the log line to help delineate one kind of log from

View File

@ -23,7 +23,7 @@ type Config struct {
type Pmux struct { type Pmux struct {
processes map[string]*Process processes map[string]*Process
stdoutLogger, stderrLogger, sysLogger Logger stdoutLogger, stderrLogger, sysLogger *PmuxLogger
} }
// NewPmux starts a Pmux with the given configuration. // NewPmux starts a Pmux with the given configuration.