rebase: bump github.com/hashicorp/vault from 1.9.9 to 1.11.9

Bumps [github.com/hashicorp/vault](https://github.com/hashicorp/vault) from 1.9.9 to 1.11.9.
- [Release notes](https://github.com/hashicorp/vault/releases)
- [Changelog](https://github.com/hashicorp/vault/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/vault/compare/v1.9.9...v1.11.9)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/vault
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2023-05-10 07:55:28 +00:00
committed by mergify[bot]
parent 001703e901
commit 9b6795c6d6
40 changed files with 4577 additions and 125 deletions

View File

@ -17,7 +17,7 @@ JSON output mode for production.
## Stability Note
This library has reached 1.0 stability. It's API can be considered solidified
This library has reached 1.0 stability. Its API can be considered solidified
and promised through future versions.
## Installation and Docs

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package hclog
@ -7,7 +8,7 @@ import (
)
// setColorization will mutate the values of this logger
// to approperately configure colorization options. It provides
// 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 {
@ -21,6 +22,7 @@ func (l *intLogger) setColorization(opts *LoggerOptions) {
isCygwinTerm := isatty.IsCygwinTerminal(fi.Fd())
isTerm := isUnixTerm || isCygwinTerm
if !isTerm {
l.headerColor = ColorOff
l.writer.color = ColorOff
}
}

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package hclog
@ -10,7 +11,7 @@ import (
)
// setColorization will mutate the values of this logger
// to approperately configure colorization options. It provides
// 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 {
@ -26,8 +27,12 @@ func (l *intLogger) setColorization(opts *LoggerOptions) {
isTerm := isUnixTerm || isCygwinTerm
if !isTerm {
l.writer.color = ColorOff
l.headerColor = ColorOff
return
}
l.writer.w = colorable.NewColorable(fi)
if l.headerColor == ColorOff {
l.writer.w = colorable.NewColorable(fi)
}
}
}

View File

@ -20,13 +20,13 @@ var (
)
// Default returns a globally held logger. This can be a good starting
// place, and then you can use .With() and .Name() to create sub-loggers
// place, and then you can use .With() and .Named() to create sub-loggers
// to be used in more specific contexts.
// The value of the Default logger can be set via SetDefault() or by
// changing the options in DefaultOptions.
//
// This method is goroutine safe, returning a global from memory, but
// cause should be used if SetDefault() is called it random times
// care should be used if SetDefault() is called it random times
// in the program as that may result in race conditions and an unexpected
// Logger being returned.
func Default() Logger {

View File

@ -69,6 +69,8 @@ type intLogger struct {
writer *writer
level *int32
headerColor ColorOption
implied []interface{}
exclude func(level Level, msg string, args ...interface{}) bool
@ -113,6 +115,16 @@ func newLogger(opts *LoggerOptions) *intLogger {
mutex = new(sync.Mutex)
}
var primaryColor, headerColor ColorOption
if opts.ColorHeaderOnly {
primaryColor = ColorOff
headerColor = opts.Color
} else {
primaryColor = opts.Color
headerColor = ColorOff
}
l := &intLogger{
json: opts.JSONFormat,
name: opts.Name,
@ -120,10 +132,11 @@ func newLogger(opts *LoggerOptions) *intLogger {
timeFn: time.Now,
disableTime: opts.DisableTime,
mutex: mutex,
writer: newWriter(output, opts.Color),
writer: newWriter(output, primaryColor),
level: new(int32),
exclude: opts.Exclude,
independentLevels: opts.IndependentLevels,
headerColor: headerColor,
}
if opts.IncludeLocation {
l.callerOffset = offsetIntLogger + opts.AdditionalLocationOffset
@ -147,7 +160,7 @@ func newLogger(opts *LoggerOptions) *intLogger {
}
// offsetIntLogger is the stack frame offset in the call stack for the caller to
// one of the Warn,Info,Log,etc methods.
// one of the Warn, Info, Log, etc methods.
const offsetIntLogger = 3
// Log a message and a set of key/value pairs if the given level is at
@ -232,7 +245,12 @@ func (l *intLogger) logPlain(t time.Time, name string, level Level, msg string,
s, ok := _levelToBracket[level]
if ok {
l.writer.WriteString(s)
if l.headerColor != ColorOff {
color := _levelToColor[level]
color.Fprint(l.writer, s)
} else {
l.writer.WriteString(s)
}
} else {
l.writer.WriteString("[?????]")
}
@ -251,11 +269,14 @@ func (l *intLogger) logPlain(t time.Time, name string, level Level, msg string,
if name != "" {
l.writer.WriteString(name)
l.writer.WriteString(": ")
if msg != "" {
l.writer.WriteString(": ")
l.writer.WriteString(msg)
}
} else if msg != "" {
l.writer.WriteString(msg)
}
l.writer.WriteString(msg)
args = append(l.implied, args...)
var stacktrace CapturedStacktrace

View File

@ -9,7 +9,7 @@ import (
)
var (
//DefaultOutput is used as the default log output.
// DefaultOutput is used as the default log output.
DefaultOutput io.Writer = os.Stderr
// DefaultLevel is used as the default log level.
@ -28,7 +28,7 @@ const (
// of actions in code, such as function enters/exits, etc.
Trace Level = 1
// Debug information for programmer lowlevel analysis.
// Debug information for programmer low-level analysis.
Debug Level = 2
// Info information about steady state operations.
@ -44,13 +44,13 @@ const (
Off Level = 6
)
// Format is a simple convience type for when formatting is required. When
// Format is a simple convenience type for when formatting is required. When
// processing a value of this type, the logger automatically treats the first
// argument as a Printf formatting string and passes the rest as the values
// to be formatted. For example: L.Info(Fmt{"%d beans/day", beans}).
type Format []interface{}
// Fmt returns a Format type. This is a convience function for creating a Format
// Fmt returns a Format type. This is a convenience function for creating a Format
// type.
func Fmt(str string, args ...interface{}) Format {
return append(Format{str}, args...)
@ -134,7 +134,7 @@ func (l Level) String() string {
}
}
// Logger describes the interface that must be implemeted by all loggers.
// Logger describes the interface that must be implemented by all loggers.
type Logger interface {
// Args are alternating key, val pairs
// keys must be strings
@ -236,7 +236,7 @@ type LoggerOptions struct {
// Name of the subsystem to prefix logs with
Name string
// The threshold for the logger. Anything less severe is supressed
// The threshold for the logger. Anything less severe is suppressed
Level Level
// Where to write the logs to. Defaults to os.Stderr if nil
@ -267,10 +267,13 @@ type LoggerOptions struct {
// because setting TimeFormat to empty assumes the default format.
DisableTime bool
// Color the output. On Windows, colored logs are only avaiable for io.Writers that
// Color the output. On Windows, colored logs are only available for io.Writers that
// are concretely instances of *os.File.
Color ColorOption
// Only color the header, not the body. This can help with readability of long messages.
ColorHeaderOnly bool
// A function which is called with the log information and if it returns true the value
// should not be logged.
// This is useful when interacting with a system that you wish to suppress the log
@ -279,8 +282,8 @@ type LoggerOptions struct {
// IndependentLevels causes subloggers to be created with an independent
// copy of this logger's level. This means that using SetLevel on this
// logger will not effect any subloggers, and SetLevel on any subloggers
// will not effect the parent or sibling loggers.
// logger will not affect any subloggers, and SetLevel on any subloggers
// will not affect the parent or sibling loggers.
IndependentLevels bool
}