Bump dependencies to Kubernetes 1.20
This commit is contained in:
16
vendor/k8s.io/klog/.travis.yml
generated
vendored
Normal file
16
vendor/k8s.io/klog/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
language: go
|
||||
go_import_path: k8s.io/klog
|
||||
dist: xenial
|
||||
go:
|
||||
- 1.9.x
|
||||
- 1.10.x
|
||||
- 1.11.x
|
||||
- 1.12.x
|
||||
script:
|
||||
- go get -t -v ./...
|
||||
- diff -u <(echo -n) <(gofmt -d .)
|
||||
- diff -u <(echo -n) <(golint $(go list -e ./...))
|
||||
- go tool vet . || go vet .
|
||||
- go test -v -race ./...
|
||||
install:
|
||||
- go get golang.org/x/lint/golint
|
22
vendor/k8s.io/klog/CONTRIBUTING.md
generated
vendored
Normal file
22
vendor/k8s.io/klog/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
Welcome to Kubernetes. We are excited about the prospect of you joining our [community](https://github.com/kubernetes/community)! The Kubernetes community abides by the CNCF [code of conduct](code-of-conduct.md). Here is an excerpt:
|
||||
|
||||
_As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities._
|
||||
|
||||
## Getting Started
|
||||
|
||||
We have full documentation on how to get started contributing here:
|
||||
|
||||
- [Contributor License Agreement](https://git.k8s.io/community/CLA.md) Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests
|
||||
- [Kubernetes Contributor Guide](http://git.k8s.io/community/contributors/guide) - Main contributor documentation, or you can just jump directly to the [contributing section](http://git.k8s.io/community/contributors/guide#contributing)
|
||||
- [Contributor Cheat Sheet](https://git.k8s.io/community/contributors/guide/contributor-cheatsheet.md) - Common resources for existing developers
|
||||
|
||||
## Mentorship
|
||||
|
||||
- [Mentoring Initiatives](https://git.k8s.io/community/mentoring) - We have a diverse set of mentorship programs available that are always looking for volunteers!
|
||||
|
||||
## Contact Information
|
||||
|
||||
- [Slack](https://kubernetes.slack.com/messages/sig-architecture)
|
||||
- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-architecture)
|
191
vendor/k8s.io/klog/LICENSE
generated
vendored
Normal file
191
vendor/k8s.io/klog/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution.
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions.
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
6. Trademarks.
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
8. Limitation of Liability.
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability.
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets "[]" replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same "printed page" as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
19
vendor/k8s.io/klog/OWNERS
generated
vendored
Normal file
19
vendor/k8s.io/klog/OWNERS
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
reviewers:
|
||||
- jayunit100
|
||||
- hoegaarden
|
||||
- andyxning
|
||||
- neolit123
|
||||
- pohly
|
||||
- yagonobre
|
||||
- vincepri
|
||||
- detiber
|
||||
approvers:
|
||||
- dims
|
||||
- thockin
|
||||
- justinsb
|
||||
- tallclair
|
||||
- piosz
|
||||
- brancz
|
||||
- DirectXMan12
|
||||
- lavalamp
|
97
vendor/k8s.io/klog/README.md
generated
vendored
Normal file
97
vendor/k8s.io/klog/README.md
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
klog
|
||||
====
|
||||
|
||||
klog is a permanent fork of https://github.com/golang/glog.
|
||||
|
||||
## Why was klog created?
|
||||
|
||||
The decision to create klog was one that wasn't made lightly, but it was necessary due to some
|
||||
drawbacks that are present in [glog](https://github.com/golang/glog). Ultimately, the fork was created due to glog not being under active development; this can be seen in the glog README:
|
||||
|
||||
> The code in this repo [...] is not itself under development
|
||||
|
||||
This makes us unable to solve many use cases without a fork. The factors that contributed to needing feature development are listed below:
|
||||
|
||||
* `glog` [presents a lot "gotchas"](https://github.com/kubernetes/kubernetes/issues/61006) and introduces challenges in containerized environments, all of which aren't well documented.
|
||||
* `glog` doesn't provide an easy way to test logs, which detracts from the stability of software using it
|
||||
* A long term goal is to implement a logging interface that allows us to add context, change output format, etc.
|
||||
|
||||
Historical context is available here:
|
||||
|
||||
* https://github.com/kubernetes/kubernetes/issues/61006
|
||||
* https://github.com/kubernetes/kubernetes/issues/70264
|
||||
* https://groups.google.com/forum/#!msg/kubernetes-sig-architecture/wCWiWf3Juzs/hXRVBH90CgAJ
|
||||
* https://groups.google.com/forum/#!msg/kubernetes-dev/7vnijOMhLS0/1oRiNtigBgAJ
|
||||
|
||||
----
|
||||
|
||||
How to use klog
|
||||
===============
|
||||
- Replace imports for `github.com/golang/glog` with `k8s.io/klog`
|
||||
- Use `klog.InitFlags(nil)` explicitly for initializing global flags as we no longer use `init()` method to register the flags
|
||||
- You can now use `log-file` instead of `log-dir` for logging to a single file (See `examples/log_file/usage_log_file.go`)
|
||||
- If you want to redirect everything logged using klog somewhere else (say syslog!), you can use `klog.SetOutput()` method and supply a `io.Writer`. (See `examples/set_output/usage_set_output.go`)
|
||||
- For more logging conventions (See [Logging Conventions](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md))
|
||||
|
||||
### Coexisting with glog
|
||||
This package can be used side by side with glog. [This example](examples/coexist_glog/coexist_glog.go) shows how to initialize and syncronize flags from the global `flag.CommandLine` FlagSet. In addition, the example makes use of stderr as combined output by setting `alsologtostderr` (or `logtostderr`) to `true`.
|
||||
|
||||
## Community, discussion, contribution, and support
|
||||
|
||||
Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/).
|
||||
|
||||
You can reach the maintainers of this project at:
|
||||
|
||||
- [Slack](https://kubernetes.slack.com/messages/sig-architecture)
|
||||
- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-architecture)
|
||||
|
||||
### Code of conduct
|
||||
|
||||
Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).
|
||||
|
||||
----
|
||||
|
||||
glog
|
||||
====
|
||||
|
||||
Leveled execution logs for Go.
|
||||
|
||||
This is an efficient pure Go implementation of leveled logs in the
|
||||
manner of the open source C++ package
|
||||
https://github.com/google/glog
|
||||
|
||||
By binding methods to booleans it is possible to use the log package
|
||||
without paying the expense of evaluating the arguments to the log.
|
||||
Through the -vmodule flag, the package also provides fine-grained
|
||||
control over logging at the file level.
|
||||
|
||||
The comment from glog.go introduces the ideas:
|
||||
|
||||
Package glog implements logging analogous to the Google-internal
|
||||
C++ INFO/ERROR/V setup. It provides functions Info, Warning,
|
||||
Error, Fatal, plus formatting variants such as Infof. It
|
||||
also provides V-style logging controlled by the -v and
|
||||
-vmodule=file=2 flags.
|
||||
|
||||
Basic examples:
|
||||
|
||||
glog.Info("Prepare to repel boarders")
|
||||
|
||||
glog.Fatalf("Initialization failed: %s", err)
|
||||
|
||||
See the documentation for the V function for an explanation
|
||||
of these examples:
|
||||
|
||||
if glog.V(2) {
|
||||
glog.Info("Starting transaction...")
|
||||
}
|
||||
|
||||
glog.V(2).Infoln("Processed", nItems, "elements")
|
||||
|
||||
|
||||
The repository contains an open source version of the log package
|
||||
used inside Google. The master copy of the source lives inside
|
||||
Google, not here. The code in this repo is for export only and is not itself
|
||||
under development. Feature requests will be ignored.
|
||||
|
||||
Send bug reports to golang-nuts@googlegroups.com.
|
9
vendor/k8s.io/klog/RELEASE.md
generated
vendored
Normal file
9
vendor/k8s.io/klog/RELEASE.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# Release Process
|
||||
|
||||
The `klog` is released on an as-needed basis. The process is as follows:
|
||||
|
||||
1. An issue is proposing a new release with a changelog since the last release
|
||||
1. All [OWNERS](OWNERS) must LGTM this release
|
||||
1. An OWNER runs `git tag -s $VERSION` and inserts the changelog and pushes the tag with `git push $VERSION`
|
||||
1. The release issue is closed
|
||||
1. An announcement email is sent to `kubernetes-dev@googlegroups.com` with the subject `[ANNOUNCE] kubernetes-template-project $VERSION is released`
|
20
vendor/k8s.io/klog/SECURITY_CONTACTS
generated
vendored
Normal file
20
vendor/k8s.io/klog/SECURITY_CONTACTS
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# Defined below are the security contacts for this repo.
|
||||
#
|
||||
# They are the contact point for the Product Security Committee to reach out
|
||||
# to for triaging and handling of incoming issues.
|
||||
#
|
||||
# The below names agree to abide by the
|
||||
# [Embargo Policy](https://git.k8s.io/security/private-distributors-list.md#embargo-policy)
|
||||
# and will be removed and replaced if they violate that agreement.
|
||||
#
|
||||
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
|
||||
# INSTRUCTIONS AT https://kubernetes.io/security/
|
||||
|
||||
dims
|
||||
thockin
|
||||
justinsb
|
||||
tallclair
|
||||
piosz
|
||||
brancz
|
||||
DirectXMan12
|
||||
lavalamp
|
3
vendor/k8s.io/klog/code-of-conduct.md
generated
vendored
Normal file
3
vendor/k8s.io/klog/code-of-conduct.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Kubernetes Community Code of Conduct
|
||||
|
||||
Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md)
|
5
vendor/k8s.io/klog/go.mod
generated
vendored
Normal file
5
vendor/k8s.io/klog/go.mod
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
module k8s.io/klog
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/go-logr/logr v0.1.0
|
2
vendor/k8s.io/klog/go.sum
generated
vendored
Normal file
2
vendor/k8s.io/klog/go.sum
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
github.com/go-logr/logr v0.1.0 h1:M1Tv3VzNlEHg6uyACnRdtrploV2P7wZqH8BoQMtz0cg=
|
||||
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
1308
vendor/k8s.io/klog/klog.go
generated
vendored
Normal file
1308
vendor/k8s.io/klog/klog.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
139
vendor/k8s.io/klog/klog_file.go
generated
vendored
Normal file
139
vendor/k8s.io/klog/klog_file.go
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/
|
||||
//
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// File I/O for logs.
|
||||
|
||||
package klog
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// MaxSize is the maximum size of a log file in bytes.
|
||||
var MaxSize uint64 = 1024 * 1024 * 1800
|
||||
|
||||
// logDirs lists the candidate directories for new log files.
|
||||
var logDirs []string
|
||||
|
||||
func createLogDirs() {
|
||||
if logging.logDir != "" {
|
||||
logDirs = append(logDirs, logging.logDir)
|
||||
}
|
||||
logDirs = append(logDirs, os.TempDir())
|
||||
}
|
||||
|
||||
var (
|
||||
pid = os.Getpid()
|
||||
program = filepath.Base(os.Args[0])
|
||||
host = "unknownhost"
|
||||
userName = "unknownuser"
|
||||
)
|
||||
|
||||
func init() {
|
||||
h, err := os.Hostname()
|
||||
if err == nil {
|
||||
host = shortHostname(h)
|
||||
}
|
||||
|
||||
current, err := user.Current()
|
||||
if err == nil {
|
||||
userName = current.Username
|
||||
}
|
||||
|
||||
// Sanitize userName since it may contain filepath separators on Windows.
|
||||
userName = strings.Replace(userName, `\`, "_", -1)
|
||||
}
|
||||
|
||||
// shortHostname returns its argument, truncating at the first period.
|
||||
// For instance, given "www.google.com" it returns "www".
|
||||
func shortHostname(hostname string) string {
|
||||
if i := strings.Index(hostname, "."); i >= 0 {
|
||||
return hostname[:i]
|
||||
}
|
||||
return hostname
|
||||
}
|
||||
|
||||
// logName returns a new log file name containing tag, with start time t, and
|
||||
// the name for the symlink for tag.
|
||||
func logName(tag string, t time.Time) (name, link string) {
|
||||
name = fmt.Sprintf("%s.%s.%s.log.%s.%04d%02d%02d-%02d%02d%02d.%d",
|
||||
program,
|
||||
host,
|
||||
userName,
|
||||
tag,
|
||||
t.Year(),
|
||||
t.Month(),
|
||||
t.Day(),
|
||||
t.Hour(),
|
||||
t.Minute(),
|
||||
t.Second(),
|
||||
pid)
|
||||
return name, program + "." + tag
|
||||
}
|
||||
|
||||
var onceLogDirs sync.Once
|
||||
|
||||
// create creates a new log file and returns the file and its filename, which
|
||||
// contains tag ("INFO", "FATAL", etc.) and t. If the file is created
|
||||
// successfully, create also attempts to update the symlink for that tag, ignoring
|
||||
// errors.
|
||||
// The startup argument indicates whether this is the initial startup of klog.
|
||||
// If startup is true, existing files are opened for appending instead of truncated.
|
||||
func create(tag string, t time.Time, startup bool) (f *os.File, filename string, err error) {
|
||||
if logging.logFile != "" {
|
||||
f, err := openOrCreate(logging.logFile, startup)
|
||||
if err == nil {
|
||||
return f, logging.logFile, nil
|
||||
}
|
||||
return nil, "", fmt.Errorf("log: unable to create log: %v", err)
|
||||
}
|
||||
onceLogDirs.Do(createLogDirs)
|
||||
if len(logDirs) == 0 {
|
||||
return nil, "", errors.New("log: no log dirs")
|
||||
}
|
||||
name, link := logName(tag, t)
|
||||
var lastErr error
|
||||
for _, dir := range logDirs {
|
||||
fname := filepath.Join(dir, name)
|
||||
f, err := openOrCreate(fname, startup)
|
||||
if err == nil {
|
||||
symlink := filepath.Join(dir, link)
|
||||
os.Remove(symlink) // ignore err
|
||||
os.Symlink(name, symlink) // ignore err
|
||||
return f, fname, nil
|
||||
}
|
||||
lastErr = err
|
||||
}
|
||||
return nil, "", fmt.Errorf("log: cannot create log: %v", lastErr)
|
||||
}
|
||||
|
||||
// The startup argument indicates whether this is the initial startup of klog.
|
||||
// If startup is true, existing files are opened for appending instead of truncated.
|
||||
func openOrCreate(name string, startup bool) (*os.File, error) {
|
||||
if startup {
|
||||
f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
return f, err
|
||||
}
|
||||
f, err := os.Create(name)
|
||||
return f, err
|
||||
}
|
6
vendor/k8s.io/klog/v2/README.md
generated
vendored
6
vendor/k8s.io/klog/v2/README.md
generated
vendored
@@ -27,7 +27,7 @@ Historical context is available here:
|
||||
|
||||
How to use klog
|
||||
===============
|
||||
- Replace imports for `github.com/golang/glog` with `k8s.io/klog`
|
||||
- Replace imports for `"github.com/golang/glog"` with `"k8s.io/klog/v2"`
|
||||
- Use `klog.InitFlags(nil)` explicitly for initializing global flags as we no longer use `init()` method to register the flags
|
||||
- You can now use `log_file` instead of `log_dir` for logging to a single file (See `examples/log_file/usage_log_file.go`)
|
||||
- If you want to redirect everything logged using klog somewhere else (say syslog!), you can use `klog.SetOutput()` method and supply a `io.Writer`. (See `examples/set_output/usage_set_output.go`)
|
||||
@@ -35,6 +35,10 @@ How to use klog
|
||||
|
||||
**NOTE**: please use the newer go versions that support semantic import versioning in modules, ideally go 1.11.4 or greater.
|
||||
|
||||
### Coexisting with klog/v2
|
||||
|
||||
See [this example](examples/coexist_klog_v1_and_v2/) to see how to coexist with both klog/v1 and klog/v2.
|
||||
|
||||
### Coexisting with glog
|
||||
This package can be used side by side with glog. [This example](examples/coexist_glog/coexist_glog.go) shows how to initialize and synchronize flags from the global `flag.CommandLine` FlagSet. In addition, the example makes use of stderr as combined output by setting `alsologtostderr` (or `logtostderr`) to `true`.
|
||||
|
||||
|
22
vendor/k8s.io/klog/v2/SECURITY.md
generated
vendored
Normal file
22
vendor/k8s.io/klog/v2/SECURITY.md
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Security Policy
|
||||
|
||||
## Security Announcements
|
||||
|
||||
Join the [kubernetes-security-announce] group for security and vulnerability announcements.
|
||||
|
||||
You can also subscribe to an RSS feed of the above using [this link][kubernetes-security-announce-rss].
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Instructions for reporting a vulnerability can be found on the
|
||||
[Kubernetes Security and Disclosure Information] page.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Information about supported Kubernetes versions can be found on the
|
||||
[Kubernetes version and version skew support policy] page on the Kubernetes website.
|
||||
|
||||
[kubernetes-security-announce]: https://groups.google.com/forum/#!forum/kubernetes-security-announce
|
||||
[kubernetes-security-announce-rss]: https://groups.google.com/forum/feed/kubernetes-security-announce/msgs/rss_v2_0.xml?num=50
|
||||
[Kubernetes version and version skew support policy]: https://kubernetes.io/docs/setup/release/version-skew-policy/#supported-versions
|
||||
[Kubernetes Security and Disclosure Information]: https://kubernetes.io/docs/reference/issues-security/security/#report-a-vulnerability
|
168
vendor/k8s.io/klog/v2/klog.go
generated
vendored
168
vendor/k8s.io/klog/v2/klog.go
generated
vendored
@@ -413,6 +413,7 @@ func init() {
|
||||
logging.skipHeaders = false
|
||||
logging.addDirHeader = false
|
||||
logging.skipLogHeaders = false
|
||||
logging.oneOutput = false
|
||||
go logging.flushDaemon()
|
||||
}
|
||||
|
||||
@@ -432,6 +433,7 @@ func InitFlags(flagset *flag.FlagSet) {
|
||||
flagset.Var(&logging.verbosity, "v", "number for the log level verbosity")
|
||||
flagset.BoolVar(&logging.addDirHeader, "add_dir_header", logging.addDirHeader, "If true, adds the file directory to the header of the log messages")
|
||||
flagset.BoolVar(&logging.skipHeaders, "skip_headers", logging.skipHeaders, "If true, avoid header prefixes in the log messages")
|
||||
flagset.BoolVar(&logging.oneOutput, "one_output", logging.oneOutput, "If true, only write logs to their native severity level (vs also writing to each lower severity level")
|
||||
flagset.BoolVar(&logging.skipLogHeaders, "skip_log_headers", logging.skipLogHeaders, "If true, avoid headers when opening log files")
|
||||
flagset.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr")
|
||||
flagset.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging")
|
||||
@@ -505,6 +507,12 @@ type loggingT struct {
|
||||
|
||||
// If set, all output will be redirected unconditionally to the provided logr.Logger
|
||||
logr logr.Logger
|
||||
|
||||
// If true, messages will not be propagated to lower severity log levels
|
||||
oneOutput bool
|
||||
|
||||
// If set, all output will be filtered through the filter.
|
||||
filter LogFilter
|
||||
}
|
||||
|
||||
// buffer holds a byte Buffer for reuse. The zero value is ready for use.
|
||||
@@ -687,7 +695,7 @@ func (buf *buffer) someDigits(i, d int) int {
|
||||
return copy(buf.tmp[i:], buf.tmp[j:])
|
||||
}
|
||||
|
||||
func (l *loggingT) println(s severity, logr logr.Logger, args ...interface{}) {
|
||||
func (l *loggingT) println(s severity, logr logr.Logger, filter LogFilter, args ...interface{}) {
|
||||
buf, file, line := l.header(s, 0)
|
||||
// if logr is set, we clear the generated header as we rely on the backing
|
||||
// logr implementation to print headers
|
||||
@@ -695,15 +703,18 @@ func (l *loggingT) println(s severity, logr logr.Logger, args ...interface{}) {
|
||||
l.putBuffer(buf)
|
||||
buf = l.getBuffer()
|
||||
}
|
||||
if filter != nil {
|
||||
args = filter.Filter(args)
|
||||
}
|
||||
fmt.Fprintln(buf, args...)
|
||||
l.output(s, logr, buf, file, line, false)
|
||||
}
|
||||
|
||||
func (l *loggingT) print(s severity, logr logr.Logger, args ...interface{}) {
|
||||
l.printDepth(s, logr, 1, args...)
|
||||
func (l *loggingT) print(s severity, logr logr.Logger, filter LogFilter, args ...interface{}) {
|
||||
l.printDepth(s, logr, filter, 1, args...)
|
||||
}
|
||||
|
||||
func (l *loggingT) printDepth(s severity, logr logr.Logger, depth int, args ...interface{}) {
|
||||
func (l *loggingT) printDepth(s severity, logr logr.Logger, filter LogFilter, depth int, args ...interface{}) {
|
||||
buf, file, line := l.header(s, depth)
|
||||
// if logr is set, we clear the generated header as we rely on the backing
|
||||
// logr implementation to print headers
|
||||
@@ -711,6 +722,9 @@ func (l *loggingT) printDepth(s severity, logr logr.Logger, depth int, args ...i
|
||||
l.putBuffer(buf)
|
||||
buf = l.getBuffer()
|
||||
}
|
||||
if filter != nil {
|
||||
args = filter.Filter(args)
|
||||
}
|
||||
fmt.Fprint(buf, args...)
|
||||
if buf.Bytes()[buf.Len()-1] != '\n' {
|
||||
buf.WriteByte('\n')
|
||||
@@ -718,7 +732,7 @@ func (l *loggingT) printDepth(s severity, logr logr.Logger, depth int, args ...i
|
||||
l.output(s, logr, buf, file, line, false)
|
||||
}
|
||||
|
||||
func (l *loggingT) printf(s severity, logr logr.Logger, format string, args ...interface{}) {
|
||||
func (l *loggingT) printf(s severity, logr logr.Logger, filter LogFilter, format string, args ...interface{}) {
|
||||
buf, file, line := l.header(s, 0)
|
||||
// if logr is set, we clear the generated header as we rely on the backing
|
||||
// logr implementation to print headers
|
||||
@@ -726,6 +740,9 @@ func (l *loggingT) printf(s severity, logr logr.Logger, format string, args ...i
|
||||
l.putBuffer(buf)
|
||||
buf = l.getBuffer()
|
||||
}
|
||||
if filter != nil {
|
||||
format, args = filter.FilterF(format, args)
|
||||
}
|
||||
fmt.Fprintf(buf, format, args...)
|
||||
if buf.Bytes()[buf.Len()-1] != '\n' {
|
||||
buf.WriteByte('\n')
|
||||
@@ -736,7 +753,7 @@ func (l *loggingT) printf(s severity, logr logr.Logger, format string, args ...i
|
||||
// printWithFileLine behaves like print but uses the provided file and line number. If
|
||||
// alsoLogToStderr is true, the log message always appears on standard error; it
|
||||
// will also appear in the log file unless --logtostderr is set.
|
||||
func (l *loggingT) printWithFileLine(s severity, logr logr.Logger, file string, line int, alsoToStderr bool, args ...interface{}) {
|
||||
func (l *loggingT) printWithFileLine(s severity, logr logr.Logger, filter LogFilter, file string, line int, alsoToStderr bool, args ...interface{}) {
|
||||
buf := l.formatHeader(s, file, line)
|
||||
// if logr is set, we clear the generated header as we rely on the backing
|
||||
// logr implementation to print headers
|
||||
@@ -744,6 +761,9 @@ func (l *loggingT) printWithFileLine(s severity, logr logr.Logger, file string,
|
||||
l.putBuffer(buf)
|
||||
buf = l.getBuffer()
|
||||
}
|
||||
if filter != nil {
|
||||
args = filter.Filter(args)
|
||||
}
|
||||
fmt.Fprint(buf, args...)
|
||||
if buf.Bytes()[buf.Len()-1] != '\n' {
|
||||
buf.WriteByte('\n')
|
||||
@@ -752,18 +772,24 @@ func (l *loggingT) printWithFileLine(s severity, logr logr.Logger, file string,
|
||||
}
|
||||
|
||||
// if loggr is specified, will call loggr.Error, otherwise output with logging module.
|
||||
func (l *loggingT) errorS(err error, loggr logr.Logger, msg string, keysAndValues ...interface{}) {
|
||||
func (l *loggingT) errorS(err error, loggr logr.Logger, filter LogFilter, msg string, keysAndValues ...interface{}) {
|
||||
if filter != nil {
|
||||
msg, keysAndValues = filter.FilterS(msg, keysAndValues)
|
||||
}
|
||||
if loggr != nil {
|
||||
loggr.Error(err, msg, keysAndValues)
|
||||
loggr.Error(err, msg, keysAndValues...)
|
||||
return
|
||||
}
|
||||
l.printS(err, msg, keysAndValues...)
|
||||
}
|
||||
|
||||
// if loggr is specified, will call loggr.Info, otherwise output with logging module.
|
||||
func (l *loggingT) infoS(loggr logr.Logger, msg string, keysAndValues ...interface{}) {
|
||||
func (l *loggingT) infoS(loggr logr.Logger, filter LogFilter, msg string, keysAndValues ...interface{}) {
|
||||
if filter != nil {
|
||||
msg, keysAndValues = filter.FilterS(msg, keysAndValues)
|
||||
}
|
||||
if loggr != nil {
|
||||
loggr.Info(msg, keysAndValues)
|
||||
loggr.Info(msg, keysAndValues...)
|
||||
return
|
||||
}
|
||||
l.printS(nil, msg, keysAndValues...)
|
||||
@@ -785,7 +811,7 @@ func (l *loggingT) printS(err error, msg string, keysAndValues ...interface{}) {
|
||||
} else {
|
||||
s = errorLog
|
||||
}
|
||||
l.printDepth(s, logging.logr, 2, b)
|
||||
l.printDepth(s, logging.logr, nil, 2, b)
|
||||
}
|
||||
|
||||
const missingValue = "(MISSING)"
|
||||
@@ -919,18 +945,22 @@ func (l *loggingT) output(s severity, log logr.Logger, buf *buffer, file string,
|
||||
}
|
||||
}
|
||||
|
||||
switch s {
|
||||
case fatalLog:
|
||||
l.file[fatalLog].Write(data)
|
||||
fallthrough
|
||||
case errorLog:
|
||||
l.file[errorLog].Write(data)
|
||||
fallthrough
|
||||
case warningLog:
|
||||
l.file[warningLog].Write(data)
|
||||
fallthrough
|
||||
case infoLog:
|
||||
l.file[infoLog].Write(data)
|
||||
if l.oneOutput {
|
||||
l.file[s].Write(data)
|
||||
} else {
|
||||
switch s {
|
||||
case fatalLog:
|
||||
l.file[fatalLog].Write(data)
|
||||
fallthrough
|
||||
case errorLog:
|
||||
l.file[errorLog].Write(data)
|
||||
fallthrough
|
||||
case warningLog:
|
||||
l.file[warningLog].Write(data)
|
||||
fallthrough
|
||||
case infoLog:
|
||||
l.file[infoLog].Write(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1077,11 +1107,19 @@ func (sb *syncBuffer) rotateFile(now time.Time, startup bool) error {
|
||||
}
|
||||
var err error
|
||||
sb.file, _, err = create(severityName[sb.sev], now, startup)
|
||||
sb.nbytes = 0
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if startup {
|
||||
fileInfo, err := sb.file.Stat()
|
||||
if err != nil {
|
||||
return fmt.Errorf("file stat could not get fileinfo: %v", err)
|
||||
}
|
||||
// init file size
|
||||
sb.nbytes = uint64(fileInfo.Size())
|
||||
} else {
|
||||
sb.nbytes = 0
|
||||
}
|
||||
sb.Writer = bufio.NewWriterSize(sb.file, bufferSize)
|
||||
|
||||
if sb.logger.skipLogHeaders {
|
||||
@@ -1197,7 +1235,7 @@ func (lb logBridge) Write(b []byte) (n int, err error) {
|
||||
}
|
||||
// printWithFileLine with alsoToStderr=true, so standard log messages
|
||||
// always appear on standard error.
|
||||
logging.printWithFileLine(severity(lb), logging.logr, file, line, true, text)
|
||||
logging.printWithFileLine(severity(lb), logging.logr, logging.filter, file, line, true, text)
|
||||
return len(b), nil
|
||||
}
|
||||
|
||||
@@ -1232,13 +1270,14 @@ func (l *loggingT) setV(pc uintptr) Level {
|
||||
type Verbose struct {
|
||||
enabled bool
|
||||
logr logr.Logger
|
||||
filter LogFilter
|
||||
}
|
||||
|
||||
func newVerbose(level Level, b bool) Verbose {
|
||||
if logging.logr == nil {
|
||||
return Verbose{b, nil}
|
||||
return Verbose{b, nil, logging.filter}
|
||||
}
|
||||
return Verbose{b, logging.logr.V(int(level))}
|
||||
return Verbose{b, logging.logr.V(int(level)), logging.filter}
|
||||
}
|
||||
|
||||
// V reports whether verbosity at the call site is at least the requested level.
|
||||
@@ -1265,7 +1304,7 @@ func V(level Level) Verbose {
|
||||
return newVerbose(level, true)
|
||||
}
|
||||
|
||||
// It's off globally but it vmodule may still be set.
|
||||
// It's off globally but vmodule may still be set.
|
||||
// Here is another cheap but safe test to see if vmodule is enabled.
|
||||
if atomic.LoadInt32(&logging.filterLength) > 0 {
|
||||
// Now we need a proper lock to use the logging structure. The pcs field
|
||||
@@ -1296,7 +1335,7 @@ func (v Verbose) Enabled() bool {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) Info(args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.print(infoLog, v.logr, args...)
|
||||
logging.print(infoLog, v.logr, v.filter, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1304,7 +1343,7 @@ func (v Verbose) Info(args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) Infoln(args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.println(infoLog, v.logr, args...)
|
||||
logging.println(infoLog, v.logr, v.filter, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1312,7 +1351,7 @@ func (v Verbose) Infoln(args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) Infof(format string, args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.printf(infoLog, v.logr, format, args...)
|
||||
logging.printf(infoLog, v.logr, v.filter, format, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1320,14 +1359,14 @@ func (v Verbose) Infof(format string, args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) InfoS(msg string, keysAndValues ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.infoS(v.logr, msg, keysAndValues...)
|
||||
logging.infoS(v.logr, v.filter, msg, keysAndValues...)
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated: Use ErrorS instead.
|
||||
func (v Verbose) Error(err error, msg string, args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.errorS(err, v.logr, msg, args...)
|
||||
logging.errorS(err, v.logr, v.filter, msg, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1335,32 +1374,32 @@ func (v Verbose) Error(err error, msg string, args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) ErrorS(err error, msg string, keysAndValues ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.errorS(err, v.logr, msg, keysAndValues...)
|
||||
logging.errorS(err, v.logr, v.filter, msg, keysAndValues...)
|
||||
}
|
||||
}
|
||||
|
||||
// Info logs to the INFO log.
|
||||
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
|
||||
func Info(args ...interface{}) {
|
||||
logging.print(infoLog, logging.logr, args...)
|
||||
logging.print(infoLog, logging.logr, logging.filter, args...)
|
||||
}
|
||||
|
||||
// InfoDepth acts as Info but uses depth to determine which call frame to log.
|
||||
// InfoDepth(0, "msg") is the same as Info("msg").
|
||||
func InfoDepth(depth int, args ...interface{}) {
|
||||
logging.printDepth(infoLog, logging.logr, depth, args...)
|
||||
logging.printDepth(infoLog, logging.logr, logging.filter, depth, args...)
|
||||
}
|
||||
|
||||
// Infoln logs to the INFO log.
|
||||
// Arguments are handled in the manner of fmt.Println; a newline is always appended.
|
||||
func Infoln(args ...interface{}) {
|
||||
logging.println(infoLog, logging.logr, args...)
|
||||
logging.println(infoLog, logging.logr, logging.filter, args...)
|
||||
}
|
||||
|
||||
// Infof logs to the INFO log.
|
||||
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
|
||||
func Infof(format string, args ...interface{}) {
|
||||
logging.printf(infoLog, logging.logr, format, args...)
|
||||
logging.printf(infoLog, logging.logr, logging.filter, format, args...)
|
||||
}
|
||||
|
||||
// InfoS structured logs to the INFO log.
|
||||
@@ -1372,55 +1411,55 @@ func Infof(format string, args ...interface{}) {
|
||||
// output:
|
||||
// >> I1025 00:15:15.525108 1 controller_utils.go:116] "Pod status updated" pod="kubedns" status="ready"
|
||||
func InfoS(msg string, keysAndValues ...interface{}) {
|
||||
logging.infoS(logging.logr, msg, keysAndValues...)
|
||||
logging.infoS(logging.logr, logging.filter, msg, keysAndValues...)
|
||||
}
|
||||
|
||||
// Warning logs to the WARNING and INFO logs.
|
||||
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
|
||||
func Warning(args ...interface{}) {
|
||||
logging.print(warningLog, logging.logr, args...)
|
||||
logging.print(warningLog, logging.logr, logging.filter, args...)
|
||||
}
|
||||
|
||||
// WarningDepth acts as Warning but uses depth to determine which call frame to log.
|
||||
// WarningDepth(0, "msg") is the same as Warning("msg").
|
||||
func WarningDepth(depth int, args ...interface{}) {
|
||||
logging.printDepth(warningLog, logging.logr, depth, args...)
|
||||
logging.printDepth(warningLog, logging.logr, logging.filter, depth, args...)
|
||||
}
|
||||
|
||||
// Warningln logs to the WARNING and INFO logs.
|
||||
// Arguments are handled in the manner of fmt.Println; a newline is always appended.
|
||||
func Warningln(args ...interface{}) {
|
||||
logging.println(warningLog, logging.logr, args...)
|
||||
logging.println(warningLog, logging.logr, logging.filter, args...)
|
||||
}
|
||||
|
||||
// Warningf logs to the WARNING and INFO logs.
|
||||
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
|
||||
func Warningf(format string, args ...interface{}) {
|
||||
logging.printf(warningLog, logging.logr, format, args...)
|
||||
logging.printf(warningLog, logging.logr, logging.filter, format, args...)
|
||||
}
|
||||
|
||||
// Error logs to the ERROR, WARNING, and INFO logs.
|
||||
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
|
||||
func Error(args ...interface{}) {
|
||||
logging.print(errorLog, logging.logr, args...)
|
||||
logging.print(errorLog, logging.logr, logging.filter, args...)
|
||||
}
|
||||
|
||||
// ErrorDepth acts as Error but uses depth to determine which call frame to log.
|
||||
// ErrorDepth(0, "msg") is the same as Error("msg").
|
||||
func ErrorDepth(depth int, args ...interface{}) {
|
||||
logging.printDepth(errorLog, logging.logr, depth, args...)
|
||||
logging.printDepth(errorLog, logging.logr, logging.filter, depth, args...)
|
||||
}
|
||||
|
||||
// Errorln logs to the ERROR, WARNING, and INFO logs.
|
||||
// Arguments are handled in the manner of fmt.Println; a newline is always appended.
|
||||
func Errorln(args ...interface{}) {
|
||||
logging.println(errorLog, logging.logr, args...)
|
||||
logging.println(errorLog, logging.logr, logging.filter, args...)
|
||||
}
|
||||
|
||||
// Errorf logs to the ERROR, WARNING, and INFO logs.
|
||||
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
|
||||
func Errorf(format string, args ...interface{}) {
|
||||
logging.printf(errorLog, logging.logr, format, args...)
|
||||
logging.printf(errorLog, logging.logr, logging.filter, format, args...)
|
||||
}
|
||||
|
||||
// ErrorS structured logs to the ERROR, WARNING, and INFO logs.
|
||||
@@ -1433,34 +1472,34 @@ func Errorf(format string, args ...interface{}) {
|
||||
// output:
|
||||
// >> E1025 00:15:15.525108 1 controller_utils.go:114] "Failed to update pod status" err="timeout"
|
||||
func ErrorS(err error, msg string, keysAndValues ...interface{}) {
|
||||
logging.errorS(err, logging.logr, msg, keysAndValues...)
|
||||
logging.errorS(err, logging.logr, logging.filter, msg, keysAndValues...)
|
||||
}
|
||||
|
||||
// Fatal logs to the FATAL, ERROR, WARNING, and INFO logs,
|
||||
// including a stack trace of all running goroutines, then calls os.Exit(255).
|
||||
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
|
||||
func Fatal(args ...interface{}) {
|
||||
logging.print(fatalLog, logging.logr, args...)
|
||||
logging.print(fatalLog, logging.logr, logging.filter, args...)
|
||||
}
|
||||
|
||||
// FatalDepth acts as Fatal but uses depth to determine which call frame to log.
|
||||
// FatalDepth(0, "msg") is the same as Fatal("msg").
|
||||
func FatalDepth(depth int, args ...interface{}) {
|
||||
logging.printDepth(fatalLog, logging.logr, depth, args...)
|
||||
logging.printDepth(fatalLog, logging.logr, logging.filter, depth, args...)
|
||||
}
|
||||
|
||||
// Fatalln logs to the FATAL, ERROR, WARNING, and INFO logs,
|
||||
// including a stack trace of all running goroutines, then calls os.Exit(255).
|
||||
// Arguments are handled in the manner of fmt.Println; a newline is always appended.
|
||||
func Fatalln(args ...interface{}) {
|
||||
logging.println(fatalLog, logging.logr, args...)
|
||||
logging.println(fatalLog, logging.logr, logging.filter, args...)
|
||||
}
|
||||
|
||||
// Fatalf logs to the FATAL, ERROR, WARNING, and INFO logs,
|
||||
// including a stack trace of all running goroutines, then calls os.Exit(255).
|
||||
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
|
||||
func Fatalf(format string, args ...interface{}) {
|
||||
logging.printf(fatalLog, logging.logr, format, args...)
|
||||
logging.printf(fatalLog, logging.logr, logging.filter, format, args...)
|
||||
}
|
||||
|
||||
// fatalNoStacks is non-zero if we are to exit without dumping goroutine stacks.
|
||||
@@ -1471,27 +1510,42 @@ var fatalNoStacks uint32
|
||||
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
|
||||
func Exit(args ...interface{}) {
|
||||
atomic.StoreUint32(&fatalNoStacks, 1)
|
||||
logging.print(fatalLog, logging.logr, args...)
|
||||
logging.print(fatalLog, logging.logr, logging.filter, args...)
|
||||
}
|
||||
|
||||
// ExitDepth acts as Exit but uses depth to determine which call frame to log.
|
||||
// ExitDepth(0, "msg") is the same as Exit("msg").
|
||||
func ExitDepth(depth int, args ...interface{}) {
|
||||
atomic.StoreUint32(&fatalNoStacks, 1)
|
||||
logging.printDepth(fatalLog, logging.logr, depth, args...)
|
||||
logging.printDepth(fatalLog, logging.logr, logging.filter, depth, args...)
|
||||
}
|
||||
|
||||
// Exitln logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).
|
||||
func Exitln(args ...interface{}) {
|
||||
atomic.StoreUint32(&fatalNoStacks, 1)
|
||||
logging.println(fatalLog, logging.logr, args...)
|
||||
logging.println(fatalLog, logging.logr, logging.filter, args...)
|
||||
}
|
||||
|
||||
// Exitf logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).
|
||||
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
|
||||
func Exitf(format string, args ...interface{}) {
|
||||
atomic.StoreUint32(&fatalNoStacks, 1)
|
||||
logging.printf(fatalLog, logging.logr, format, args...)
|
||||
logging.printf(fatalLog, logging.logr, logging.filter, format, args...)
|
||||
}
|
||||
|
||||
// LogFilter is a collection of functions that can filter all logging calls,
|
||||
// e.g. for sanitization of arguments and prevent accidental leaking of secrets.
|
||||
type LogFilter interface {
|
||||
Filter(args []interface{}) []interface{}
|
||||
FilterF(format string, args []interface{}) (string, []interface{})
|
||||
FilterS(msg string, keysAndValues []interface{}) (string, []interface{})
|
||||
}
|
||||
|
||||
func SetLogFilter(filter LogFilter) {
|
||||
logging.mu.Lock()
|
||||
defer logging.mu.Unlock()
|
||||
|
||||
logging.filter = filter
|
||||
}
|
||||
|
||||
// ObjectRef references a kubernetes object
|
||||
|
Reference in New Issue
Block a user