84c9110a24
Bumps [github.com/hashicorp/terraform-plugin-sdk/v2](https://github.com/hashicorp/terraform-plugin-sdk) from 2.24.1 to 2.26.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-sdk/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/terraform-plugin-sdk/compare/v2.24.1...v2.26.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-sdk/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
39 lines
881 B
Go
39 lines
881 B
Go
//go:build windows
|
|
// +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 appropriately 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
|
|
l.headerColor = ColorOff
|
|
return
|
|
}
|
|
|
|
if l.headerColor == ColorOff {
|
|
l.writer.w = colorable.NewColorable(fi)
|
|
}
|
|
}
|
|
}
|