mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update kubernetes to v1.21.2
Updated kubernetes packages to latest release. resizefs package has been included into k8s.io/mount-utils package. updated code to use the same. Updates: #1968 Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
1
vendor/github.com/go-logr/logr/README.md
generated
vendored
1
vendor/github.com/go-logr/logr/README.md
generated
vendored
@ -42,6 +42,7 @@ There are implementations for the following logging libraries:
|
||||
[stdr](https://github.com/go-logr/stdr)
|
||||
- **github.com/sirupsen/logrus**: [logrusr](https://github.com/bombsimon/logrusr)
|
||||
- **github.com/wojas/genericr**: [genericr](https://github.com/wojas/genericr) (makes it easy to implement your own backend)
|
||||
- **logfmt** (Heroku style [logging](https://www.brandur.org/logfmt)): [logfmtr](https://github.com/iand/logfmtr)
|
||||
|
||||
# FAQ
|
||||
|
||||
|
51
vendor/github.com/go-logr/logr/discard.go
generated
vendored
Normal file
51
vendor/github.com/go-logr/logr/discard.go
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright 2020 The logr Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package logr
|
||||
|
||||
// Discard returns a valid Logger that discards all messages logged to it.
|
||||
// It can be used whenever the caller is not interested in the logs.
|
||||
func Discard() Logger {
|
||||
return DiscardLogger{}
|
||||
}
|
||||
|
||||
// DiscardLogger is a Logger that discards all messages.
|
||||
type DiscardLogger struct{}
|
||||
|
||||
func (l DiscardLogger) Enabled() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (l DiscardLogger) Info(msg string, keysAndValues ...interface{}) {
|
||||
}
|
||||
|
||||
func (l DiscardLogger) Error(err error, msg string, keysAndValues ...interface{}) {
|
||||
}
|
||||
|
||||
func (l DiscardLogger) V(level int) Logger {
|
||||
return l
|
||||
}
|
||||
|
||||
func (l DiscardLogger) WithValues(keysAndValues ...interface{}) Logger {
|
||||
return l
|
||||
}
|
||||
|
||||
func (l DiscardLogger) WithName(name string) Logger {
|
||||
return l
|
||||
}
|
||||
|
||||
// Verify that it actually implements the interface
|
||||
var _ Logger = DiscardLogger{}
|
134
vendor/github.com/go-logr/logr/logr.go
generated
vendored
134
vendor/github.com/go-logr/logr/logr.go
generated
vendored
@ -14,18 +14,15 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package logr defines abstract interfaces for logging. Packages can depend on
|
||||
// these interfaces and callers can implement logging in whatever way is
|
||||
// appropriate.
|
||||
//
|
||||
// This design derives from Dave Cheney's blog:
|
||||
// http://dave.cheney.net/2015/11/05/lets-talk-about-logging
|
||||
//
|
||||
// This is a BETA grade API. Until there is a significant 2nd implementation,
|
||||
// I don't really know how it will change.
|
||||
//
|
||||
// The logging specifically makes it non-trivial to use format strings, to encourage
|
||||
// attaching structured information instead of unstructured format strings.
|
||||
|
||||
// Package logr defines abstract interfaces for logging. Packages can depend on
|
||||
// these interfaces and callers can implement logging in whatever way is
|
||||
// appropriate.
|
||||
//
|
||||
// Usage
|
||||
//
|
||||
@ -40,17 +37,16 @@ limitations under the License.
|
||||
// we want to log that we've made some decision.
|
||||
//
|
||||
// With the traditional log package, we might write:
|
||||
// log.Printf(
|
||||
// "decided to set field foo to value %q for object %s/%s",
|
||||
// log.Printf("decided to set field foo to value %q for object %s/%s",
|
||||
// targetValue, object.Namespace, object.Name)
|
||||
//
|
||||
// With logr's structured logging, we'd write:
|
||||
// // elsewhere in the file, set up the logger to log with the prefix of "reconcilers",
|
||||
// // and the named value target-type=Foo, for extra context.
|
||||
// log := mainLogger.WithName("reconcilers").WithValues("target-type", "Foo")
|
||||
// // elsewhere in the file, set up the logger to log with the prefix of
|
||||
// // "reconcilers", and the named value target-type=Foo, for extra context.
|
||||
// log := mainLogger.WithName("reconcilers").WithValues("target-type", "Foo")
|
||||
//
|
||||
// // later on...
|
||||
// log.Info("setting field foo on object", "value", targetValue, "object", object)
|
||||
// // later on...
|
||||
// log.Info("setting foo on object", "value", targetValue, "object", object)
|
||||
//
|
||||
// Depending on our logging implementation, we could then make logging decisions
|
||||
// based on field values (like only logging such events for objects in a certain
|
||||
@ -115,24 +111,38 @@ limitations under the License.
|
||||
// generally best to avoid using the following keys, as they're frequently used
|
||||
// by implementations:
|
||||
//
|
||||
// - `"caller"`: the calling information (file/line) of a particular log line.
|
||||
// - `"error"`: the underlying error value in the `Error` method.
|
||||
// - `"level"`: the log level.
|
||||
// - `"logger"`: the name of the associated logger.
|
||||
// - `"msg"`: the log message.
|
||||
// - `"stacktrace"`: the stack trace associated with a particular log line or
|
||||
// error (often from the `Error` message).
|
||||
// - `"ts"`: the timestamp for a log line.
|
||||
// * `"caller"`: the calling information (file/line) of a particular log line.
|
||||
// * `"error"`: the underlying error value in the `Error` method.
|
||||
// * `"level"`: the log level.
|
||||
// * `"logger"`: the name of the associated logger.
|
||||
// * `"msg"`: the log message.
|
||||
// * `"stacktrace"`: the stack trace associated with a particular log line or
|
||||
// error (often from the `Error` message).
|
||||
// * `"ts"`: the timestamp for a log line.
|
||||
//
|
||||
// Implementations are encouraged to make use of these keys to represent the
|
||||
// above concepts, when necessary (for example, in a pure-JSON output form, it
|
||||
// would be necessary to represent at least message and timestamp as ordinary
|
||||
// named values).
|
||||
//
|
||||
// Implementations may choose to give callers access to the underlying
|
||||
// logging implementation. The recommended pattern for this is:
|
||||
// // Underlier exposes access to the underlying logging implementation.
|
||||
// // Since callers only have a logr.Logger, they have to know which
|
||||
// // implementation is in use, so this interface is less of an abstraction
|
||||
// // and more of way to test type conversion.
|
||||
// type Underlier interface {
|
||||
// GetUnderlying() <underlying-type>
|
||||
// }
|
||||
package logr
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// TODO: consider adding back in format strings if they're really needed
|
||||
// TODO: consider other bits of zap/zapcore functionality like ObjectMarshaller (for arbitrary objects)
|
||||
// TODO: consider other bits of glog functionality like Flush, InfoDepth, OutputStats
|
||||
// TODO: consider other bits of glog functionality like Flush, OutputStats
|
||||
|
||||
// Logger represents the ability to log messages, both errors and not.
|
||||
type Logger interface {
|
||||
@ -177,6 +187,80 @@ type Logger interface {
|
||||
WithName(name string) Logger
|
||||
}
|
||||
|
||||
// InfoLogger provides compatibility with code that relies on the v0.1.0 interface
|
||||
// Deprecated: use Logger instead. This will be removed in a future release.
|
||||
// InfoLogger provides compatibility with code that relies on the v0.1.0
|
||||
// interface.
|
||||
//
|
||||
// Deprecated: InfoLogger is an artifact of early versions of this API. New
|
||||
// users should never use it and existing users should use Logger instead. This
|
||||
// will be removed in a future release.
|
||||
type InfoLogger = Logger
|
||||
|
||||
type contextKey struct{}
|
||||
|
||||
// FromContext returns a Logger constructed from ctx or nil if no
|
||||
// logger details are found.
|
||||
func FromContext(ctx context.Context) Logger {
|
||||
if v, ok := ctx.Value(contextKey{}).(Logger); ok {
|
||||
return v
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// FromContextOrDiscard returns a Logger constructed from ctx or a Logger
|
||||
// that discards all messages if no logger details are found.
|
||||
func FromContextOrDiscard(ctx context.Context) Logger {
|
||||
if v, ok := ctx.Value(contextKey{}).(Logger); ok {
|
||||
return v
|
||||
}
|
||||
|
||||
return Discard()
|
||||
}
|
||||
|
||||
// NewContext returns a new context derived from ctx that embeds the Logger.
|
||||
func NewContext(ctx context.Context, l Logger) context.Context {
|
||||
return context.WithValue(ctx, contextKey{}, l)
|
||||
}
|
||||
|
||||
// CallDepthLogger represents a Logger that knows how to climb the call stack
|
||||
// to identify the original call site and can offset the depth by a specified
|
||||
// number of frames. This is useful for users who have helper functions
|
||||
// between the "real" call site and the actual calls to Logger methods.
|
||||
// Implementations that log information about the call site (such as file,
|
||||
// function, or line) would otherwise log information about the intermediate
|
||||
// helper functions.
|
||||
//
|
||||
// This is an optional interface and implementations are not required to
|
||||
// support it.
|
||||
type CallDepthLogger interface {
|
||||
Logger
|
||||
|
||||
// WithCallDepth returns a Logger that will offset the call stack by the
|
||||
// specified number of frames when logging call site information. If depth
|
||||
// is 0 the attribution should be to the direct caller of this method. If
|
||||
// depth is 1 the attribution should skip 1 call frame, and so on.
|
||||
// Successive calls to this are additive.
|
||||
WithCallDepth(depth int) Logger
|
||||
}
|
||||
|
||||
// WithCallDepth returns a Logger that will offset the call stack by the
|
||||
// specified number of frames when logging call site information, if possible.
|
||||
// This is useful for users who have helper functions between the "real" call
|
||||
// site and the actual calls to Logger methods. If depth is 0 the attribution
|
||||
// should be to the direct caller of this function. If depth is 1 the
|
||||
// attribution should skip 1 call frame, and so on. Successive calls to this
|
||||
// are additive.
|
||||
//
|
||||
// If the underlying log implementation supports the CallDepthLogger interface,
|
||||
// the WithCallDepth method will be called and the result returned. If the
|
||||
// implementation does not support CallDepthLogger, the original Logger will be
|
||||
// returned.
|
||||
//
|
||||
// Callers which care about whether this was supported or not should test for
|
||||
// CallDepthLogger support themselves.
|
||||
func WithCallDepth(logger Logger, depth int) Logger {
|
||||
if decorator, ok := logger.(CallDepthLogger); ok {
|
||||
return decorator.WithCallDepth(depth)
|
||||
}
|
||||
return logger
|
||||
}
|
||||
|
Reference in New Issue
Block a user