mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
util: add FatalLog(), ErrorLog() and WarningLog() functions
These functions will always log the message, irrespectively of the log-level that has been configured. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
44863a9d29
commit
ab033f85df
@ -52,6 +52,24 @@ func Log(ctx context.Context, format string) string {
|
|||||||
return a + format
|
return a + format
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FatalLog helps in logging fatal errors.
|
||||||
|
func FatalLog(message string, args ...interface{}) {
|
||||||
|
logMessage := fmt.Sprintf(message, args...)
|
||||||
|
klog.FatalDepth(1, logMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ErrorLog helps in logging errors.
|
||||||
|
func ErrorLog(message string, args ...interface{}) {
|
||||||
|
logMessage := fmt.Sprintf(message, args...)
|
||||||
|
klog.ErrorDepth(1, logMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WarningLog helps in logging warnings.
|
||||||
|
func WarningLog(message string, args ...interface{}) {
|
||||||
|
logMessage := fmt.Sprintf(message, args...)
|
||||||
|
klog.WarningDepth(1, logMessage)
|
||||||
|
}
|
||||||
|
|
||||||
// DefaultLog helps in logging with klog.level 1.
|
// DefaultLog helps in logging with klog.level 1.
|
||||||
func DefaultLog(message string, args ...interface{}) {
|
func DefaultLog(message string, args ...interface{}) {
|
||||||
logMessage := fmt.Sprintf(message, args...)
|
logMessage := fmt.Sprintf(message, args...)
|
||||||
|
Loading…
Reference in New Issue
Block a user