Revision 470b3207efe07c66126db88e682aced94df450f5 authored by Nicolas Busseneau on 26 April 2023, 17:13:46 UTC, committed by Nicolas Busseneau on 26 April 2023, 17:13:46 UTC
Signed-off-by: Nicolas Busseneau <nicolas@isovalent.com>
1 parent b016532
Raw File
flowdebug.go
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium

package flowdebug

import (
	"github.com/sirupsen/logrus"
)

var perFlowDebug = false

// Enable enables per-flow debugging
func Enable() {
	perFlowDebug = true
}

// Enabled reports the status of per-flow debugging
func Enabled() bool {
	return perFlowDebug
}

// Log must be used to log any debug messages emitted per request/message/connection
func Log(l *logrus.Entry, args ...interface{}) {
	if perFlowDebug {
		l.Debug(args...)
	}
}

// Logf must be used to log any debug messages emitted per request/message/connection
func Logf(l *logrus.Entry, format string, args ...interface{}) {
	if perFlowDebug {
		l.Debugf(format, args...)
	}
}
back to top