|
14 | 14 | // See the License for the specific language governing permissions and
|
15 | 15 | // limitations under the License.
|
16 | 16 |
|
17 |
| -// Package klog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup. |
18 |
| -// It provides functions Info, Warning, Error, Fatal, plus formatting variants such as |
19 |
| -// Infof. It also provides V-style logging controlled by the -v and -vmodule=file=2 flags. |
| 17 | +// Package klog contains the following functionality: |
| 18 | +// |
| 19 | +// - output routing as defined via command line flags ([InitFlags]) |
| 20 | +// - log formatting as text, either with a single, unstructured string ([Info], [Infof], etc.) |
| 21 | +// or as a structured log entry with message and key/value pairs ([InfoS], etc.) |
| 22 | +// - management of a go-logr [Logger] ([SetLogger], [Background], [TODO]) |
| 23 | +// - helper functions for logging values ([Format]) and managing the state of klog ([CaptureState], [State.Restore]) |
| 24 | +// - wrappers for [logr] APIs for contextual logging where the wrappers can |
| 25 | +// be turned into no-ops ([EnableContextualLogging], [NewContext], [FromContext], |
| 26 | +// [LoggerWithValues], [LoggerWithName]); if the ability to turn off |
| 27 | +// contextual logging is not needed, then go-logr can also be used directly |
| 28 | +// - type aliases for go-logr types to simplify imports in code which uses both (e.g. [Logger]) |
| 29 | +// - [k8s.io/klog/v2/textlogger]: a logger which uses the same formatting as klog log with |
| 30 | +// simpler output routing; beware that it comes with its own command line flags |
| 31 | +// and does not use the ones from klog |
| 32 | +// - [k8s.io/klog/v2/ktesting]: per-test output in Go unit tests |
| 33 | +// - [k8s.io/klog/v2/klogr]: a deprecated, standalone [logr.Logger] on top of the main klog package; |
| 34 | +// use [Background] instead if klog output routing is needed, [k8s.io/klog/v2/textlogger] if not |
| 35 | +// - [k8s.io/klog/v2/examples]: demos of this functionality |
| 36 | +// - [k8s.io/klog/v2/test]: reusable tests for [logr.Logger] implementations |
20 | 37 | //
|
21 | 38 | // Basic examples:
|
22 | 39 | //
|
|
0 commit comments