Introduce ENABLE_JSON_LOGGING env variable (#1158)

This commit is contained in:
Alex Stockinger
2020-10-08 15:32:15 +02:00
committed by GitHub
parent 38e15183a2
commit 692c721854
6 changed files with 22 additions and 1 deletions
+3
View File
@@ -71,6 +71,9 @@ type Controller struct {
// NewController creates a new controller
func NewController(controllerConfig *spec.ControllerConfig, controllerId string) *Controller {
logger := logrus.New()
if controllerConfig.EnableJsonLogging {
logger.SetFormatter(&logrus.JSONFormatter{})
}
var myComponentName = "postgres-operator"
if controllerId != "" {
+2
View File
@@ -114,6 +114,8 @@ type ControllerConfig struct {
CRDReadyWaitTimeout time.Duration
ConfigMapName NamespacedName
Namespace string
EnableJsonLogging bool
}
// cached value for the GetOperatorNamespace