mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-10-19 05:39:51 +00:00
91774fc936
Uses github.com/libopenstorage/secrets to communicate with Vault. This removes the need for maintaining our own limited Vault APIs. By adding the new dependency, several other packages got updated in the process. Unused indirect dependencies have been removed from go.mod. Signed-off-by: Niels de Vos <ndevos@redhat.com>
34 lines
795 B
Go
34 lines
795 B
Go
// +build windows
|
|
|
|
package hclog
|
|
|
|
import (
|
|
"os"
|
|
|
|
colorable "github.com/mattn/go-colorable"
|
|
"github.com/mattn/go-isatty"
|
|
)
|
|
|
|
// setColorization will mutate the values of this logger
|
|
// to approperately configure colorization options. It provides
|
|
// a wrapper to the output stream on Windows systems.
|
|
func (l *intLogger) setColorization(opts *LoggerOptions) {
|
|
switch opts.Color {
|
|
case ColorOff:
|
|
return
|
|
case ForceColor:
|
|
fi := l.checkWriterIsFile()
|
|
l.writer.w = colorable.NewColorable(fi)
|
|
case AutoColor:
|
|
fi := l.checkWriterIsFile()
|
|
isUnixTerm := isatty.IsTerminal(os.Stdout.Fd())
|
|
isCygwinTerm := isatty.IsCygwinTerminal(os.Stdout.Fd())
|
|
isTerm := isUnixTerm || isCygwinTerm
|
|
if !isTerm {
|
|
l.writer.color = ColorOff
|
|
return
|
|
}
|
|
l.writer.w = colorable.NewColorable(fi)
|
|
}
|
|
}
|