mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-13 13:14:05 +00:00
Merge pull request #128380 from pohly/log-TODO-logcheck
apiserver: avoid TODO in public docs
This commit is contained in:
@@ -45,7 +45,7 @@ var PanicHandlers = []func(context.Context, interface{}){logPanic}
|
|||||||
//
|
//
|
||||||
// E.g., you can provide one or more additional handlers for something like shutting down go routines gracefully.
|
// E.g., you can provide one or more additional handlers for something like shutting down go routines gracefully.
|
||||||
//
|
//
|
||||||
// TODO(pohly): logcheck:context // HandleCrashWithContext should be used instead of HandleCrash in code which supports contextual logging.
|
// Contextual logging: HandleCrashWithContext should be used instead of HandleCrash in code which supports contextual logging.
|
||||||
func HandleCrash(additionalHandlers ...func(interface{})) {
|
func HandleCrash(additionalHandlers ...func(interface{})) {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
additionalHandlersWithContext := make([]func(context.Context, interface{}), len(additionalHandlers))
|
additionalHandlersWithContext := make([]func(context.Context, interface{}), len(additionalHandlers))
|
||||||
@@ -146,7 +146,7 @@ type ErrorHandler func(ctx context.Context, err error, msg string, keysAndValues
|
|||||||
// is preferable to logging the error - the default behavior is to log but the
|
// is preferable to logging the error - the default behavior is to log but the
|
||||||
// errors may be sent to a remote server for analysis.
|
// errors may be sent to a remote server for analysis.
|
||||||
//
|
//
|
||||||
// TODO(pohly): logcheck:context // HandleErrorWithContext should be used instead of HandleError in code which supports contextual logging.
|
// Contextual logging: HandleErrorWithContext should be used instead of HandleError in code which supports contextual logging.
|
||||||
func HandleError(err error) {
|
func HandleError(err error) {
|
||||||
// this is sometimes called with a nil error. We probably shouldn't fail and should do nothing instead
|
// this is sometimes called with a nil error. We probably shouldn't fail and should do nothing instead
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
Reference in New Issue
Block a user