|
1 | 1 | // |
2 | 2 | // DISCLAIMER |
3 | 3 | // |
4 | | -// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany |
| 4 | +// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany |
5 | 5 | // |
6 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | // you may not use this file except in compliance with the License. |
@@ -103,6 +103,7 @@ var ( |
103 | 103 | hardLimit uint64 |
104 | 104 | } |
105 | 105 |
|
| 106 | + prettifyLog bool |
106 | 107 | logLevels []string |
107 | 108 | serverOptions struct { |
108 | 109 | host string |
@@ -183,6 +184,7 @@ func init() { |
183 | 184 | f.StringVar(&serverOptions.tlsSecretName, "server.tls-secret-name", "", "Name of secret containing tls.crt & tls.key for HTTPS server (if empty, self-signed certificate is used)") |
184 | 185 | f.StringVar(&serverOptions.adminSecretName, "server.admin-secret-name", defaultAdminSecretName, "Name of secret containing username + password for login to the dashboard") |
185 | 186 | f.BoolVar(&serverOptions.allowAnonymous, "server.allow-anonymous-access", false, "Allow anonymous access to the dashboard") |
| 187 | + f.BoolVar(&prettifyLog, "log.prettifyLog", true, "Prettify log output (if false, log output is in JSON format)") |
186 | 188 | f.StringArrayVar(&logLevels, "log.level", []string{defaultLogLevel}, fmt.Sprintf("Set log levels in format <level> or <logger>=<level>. Possible loggers: %s", strings.Join(logging.Global().Names(), ", "))) |
187 | 189 | f.BoolVar(&apiOptions.enabled, "api.enabled", true, "Enable operator HTTP and gRPC API") |
188 | 190 | f.IntVar(&apiOptions.httpPort, "api.http-port", defaultAPIHTTPPort, "HTTP API port to listen on") |
@@ -272,6 +274,7 @@ func executeMain(cmd *cobra.Command, args []string) { |
272 | 274 | logger.Err(err).Fatal("Unable to parse log level") |
273 | 275 | } |
274 | 276 |
|
| 277 | + logging.SetGlobal(prettifyLog) |
275 | 278 | logging.Global().ApplyLogLevels(levels) |
276 | 279 |
|
277 | 280 | podNameParts := strings.Split(name, "-") |
|
0 commit comments