Documentation ¶
Overview ¶
Logging library for the troubleshoot framework.
Logging levels TODO: Document me here => https://github.com/replicatedhq/troubleshoot/issues/1031
0: also the same as not using V() log progress related information within the framework. Logs within each component (collector/analyzers/etc) should not use this level.
1: High level logs within each component (collector/analyzers/etc) should use this level. A log such as "Ceph collector connected to the cluster" belongs here.
2: Everything else goes here. If you do not know which level to use, use this level.
The best approach is to always use V(2) then after testing your code as a whole, you can elevate the log level of the messages you find useful to V(1) or V(0).
Do not log errors in functions that return an error. Instead, return the error and let the caller log it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitKlog ¶ added in v0.72.0
func InitKlog(verbosity int)
InitKlog initializes klog with a specific verbosity. This is useful when we want to use klog in a library and we want to control the verbosity from the library's caller. We can use this in tests to print instrumented logs for example.
func InitKlogFlags ¶ added in v0.58.0
InitKlogFlags initializes klog flags and adds them to the cobra command.
func SetupLogger ¶ added in v0.58.0
SetupLogger sets up klog logger based on viper configuration.
Types ¶
This section is empty.