You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why?
For users who do not wish to configure each structlog option separately, introduce presets for different cases.
What?
Introduce CLOUD and LOCAL presets.
The CLOUD preset hardcodes the following options
```sh
export VDK_STRUCTLOG_FORMAT=console
export VDK_STRUCTLOG_CONSOLE_LOG_PATTERN="%(asctime)s [VDK] %(vdk_job_name)s [%(levelname)-5.5s] %(name)-30.30s %(filename)20.20s:%(lineno)-4.4s %(funcName)-16.16s[id:%(attempt_id)s]- %(message)s"
```
LOCAL just uses the defaults set in the configuration code
Refactor structlog plugin to eliminate repeating code Remove syslog config tests
Fix bug with vdk fields crashing logging for custom format
Add tests for vdk fields with custom format
How was this tested?
Functional tests
CI
What kind of change is this?
Feature/non-breaking
Signed-off-by: Dilyan Marinov <mdilyan@vmware.com>
| logging_metadata | Configure the metadata that will be output along with the log message | "timestamp, level, logger_name, file_name, vdk_job_name | Any combination of the following: "timestamp, level, logger_name, file_name, line_number, function_name, vdk_job_name, vdk_step_name, vdk_step_type". Can be expanded by extra params and bound key-value pairs. See the bound logger examples for more information |
27
-
| logging_format | Configure the logging output format. Available formats: json, console | "console" | "console", "json", "ltsv" |
28
-
| custom_console_log_pattern | Custom format string for console logging, applied only when`logging_format` is 'console'. Overrides `logging_metadata`. | "%(asctime)s %(name)-12s %(levelname)-8s %(message)s" | Any valid Python logging format string |
29
-
| log_level_module | Configure the log level of different Python modules separately | "a.b.c=INFO;foo.bar=ERROR" | Semicolon-separated list of pairs of Python module paths and log level labels |
30
-
| syslog_host | Syslog host to which logs are emitted | "syslog.vmware.com" | Any valid host name |
31
-
| syslog_port | Syslog port used to emit logs | 514 | Any valid port number |
32
-
| syslog_protocol | Protocol used to emit logs | "UDP" | "TCP", "UDP" |
| use_structlog | Use the structlog logging config instead of using the one in vdk-core | "True" | "True", "False" |
27
+
| structlog_metadata | Configure the metadata that will be output along with the log message | "timestamp, level, logger_name, file_name, vdk_job_name | Any combination of the following: "timestamp, level, logger_name, file_name, line_number, function_name, vdk_job_name, vdk_step_name, vdk_step_type". Can be expanded by extra params and bound key-value pairs. See the bound logger examples for more information |
28
+
| structlog_format | Configure the logging output format. Available formats: json, console, ltsv | "console" | "console", "json", "ltsv" |
29
+
| structlog_console_log_pattern | Custom format string for console logging, applied only when`logging_format` is 'console'. Overrides `logging_metadata`. Note: For config.ini, %-signs should be escaped by doubling, e.g. %(asctime)s should become %%(asctime)s | "%(asctime)s %(name)-12s %(levelname)-8s %(message)s" | Any valid Python logging format string |
30
+
| structlog_config_preset | Choose a configuration preset. Available presets: LOCAL, CLOUD | "CLOUD" | "console", "json", "ltsv" |
31
+
| log_level_module | Configure the log level of different Python modules separately | "a.b.c=INFO;foo.bar=ERROR" | Semicolon-separated list of pairs of Python module paths and log level labels |
32
+
| syslog_host | Syslog host to which logs are emitted | "syslog.vmware.com" | Any valid host name |
33
+
| syslog_port | Syslog port used to emit logs | 514 | Any valid port number |
34
+
| syslog_protocol | Protocol used to emit logs | "UDP" | "TCP", "UDP" |
0 commit comments