Adding upstream version 0.0~git20250409.f7acab6.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
b9b5d88025
commit
21b930d007
51 changed files with 11229 additions and 0 deletions
38
console/std_printer.go
Normal file
38
console/std_printer.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package console
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
stderrLogger = log.Default() // the default logger output to stderr
|
||||
stdoutLogger = log.New(os.Stdout, "", log.LstdFlags)
|
||||
|
||||
defaultStdPrinter Printer = &StdPrinter{
|
||||
StdoutPrint: func(s string) { stdoutLogger.Print(s) },
|
||||
StderrPrint: func(s string) { stderrLogger.Print(s) },
|
||||
}
|
||||
)
|
||||
|
||||
// StdPrinter implements the console.Printer interface
|
||||
// that prints to the stdout or stderr.
|
||||
type StdPrinter struct {
|
||||
StdoutPrint func(s string)
|
||||
StderrPrint func(s string)
|
||||
}
|
||||
|
||||
// Log prints s to the stdout.
|
||||
func (p StdPrinter) Log(s string) {
|
||||
p.StdoutPrint(s)
|
||||
}
|
||||
|
||||
// Warn prints s to the stderr.
|
||||
func (p StdPrinter) Warn(s string) {
|
||||
p.StderrPrint(s)
|
||||
}
|
||||
|
||||
// Error prints s to the stderr.
|
||||
func (p StdPrinter) Error(s string) {
|
||||
p.StderrPrint(s)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue