Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# SPDX-License-Identifier: Apache-2.0
import logging

STRUCTLOG_LOGGING_METADATA_KEY = "logging_metadata"
STRUCTLOG_LOGGING_FORMAT_KEY = "logging_format"
STRUCTLOG_CONSOLE_LOG_PATTERN = "logging_custom_format"
STRUCTLOG_LOGGING_METADATA_KEY = "structlog_metadata"
STRUCTLOG_LOGGING_FORMAT_KEY = "structlog_format"
STRUCTLOG_CONSOLE_LOG_PATTERN = "structlog_console_custom_format"

STRUCTLOG_LOGGING_FORMAT_POSSIBLE_VALUES = ["console", "json"]
STRUCTLOG_LOGGING_FORMAT_DEFAULT = "console"
Expand Down
30 changes: 15 additions & 15 deletions projects/vdk-plugins/vdk-structlog/tests/test_structlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def test_structlog(log_format):
with mock.patch.dict(
os.environ,
{
"VDK_LOGGING_METADATA": f"timestamp,level,file_name,line_number,vdk_job_name,{BOUND_TEST_KEY},{EXTRA_TEST_KEY}",
"VDK_LOGGING_FORMAT": log_format,
"VDK_STRUCTLOG_METADATA": f"timestamp,level,file_name,line_number,vdk_job_name,{BOUND_TEST_KEY},{EXTRA_TEST_KEY}",
"VDK_STRUCTLOG_FORMAT": log_format,
"LOG_LEVEL_MODULE": "test_structlog=WARNING",
},
):
Expand Down Expand Up @@ -119,8 +119,8 @@ def test_stock_fields_removal(log_format):
with mock.patch.dict(
os.environ,
{
"VDK_LOGGING_METADATA": vdk_logging_metadata,
"VDK_LOGGING_FORMAT": log_format,
"VDK_STRUCTLOG_METADATA": vdk_logging_metadata,
"VDK_STRUCTLOG_FORMAT": log_format,
},
):
logs = _run_job_and_get_logs()
Expand All @@ -144,8 +144,8 @@ def test_custom_format_applied(log_format):
with mock.patch.dict(
os.environ,
{
"VDK_LOGGING_FORMAT": log_format,
"VDK_CUSTOM_CONSOLE_LOG_PATTERN": custom_format_string,
"VDK_STRUCTLOG_FORMAT": log_format,
"VDK_STRUCTLOG_CONSOLE_CUSTOM_FORMAT": custom_format_string,
},
):
logs = _run_job_and_get_logs()
Expand All @@ -165,9 +165,9 @@ def test_custom_format_not_applied_for_non_console_formats(log_format):
with mock.patch.dict(
os.environ,
{
"VDK_LOGGING_METADATA": "timestamp,level,file_name,vdk_job_name",
"VDK_LOGGING_FORMAT": log_format,
"VDK_CUSTOM_CONSOLE_LOG_PATTERN": custom_format_string,
"VDK_STRUCTLOG_METADATA": "timestamp,level,file_name,vdk_job_name",
"VDK_STRUCTLOG_FORMAT": log_format,
"VDK_STRUCTLOG_CUSTOM_CONSOLE_FORMAT": custom_format_string,
},
):
logs = _run_job_and_get_logs()
Expand All @@ -188,8 +188,8 @@ def test_step_name_step_type(log_format):
with mock.patch.dict(
os.environ,
{
"VDK_LOGGING_METADATA": "vdk_step_type,vdk_step_name",
"VDK_LOGGING_FORMAT": log_format,
"VDK_STRUCTLOG_METADATA": "vdk_step_type,vdk_step_name",
"VDK_STRUCTLOG_FORMAT": log_format,
},
):
logs = _run_job_and_get_logs()
Expand All @@ -200,8 +200,8 @@ def test_step_name_step_type(log_format):
with mock.patch.dict(
os.environ,
{
"VDK_LOGGING_METADATA": "vdk_step_name",
"VDK_LOGGING_FORMAT": log_format,
"VDK_STRUCTLOG_METADATA": "vdk_step_name",
"VDK_STRUCTLOG_FORMAT": log_format,
},
):
logs = _run_job_and_get_logs()
Expand All @@ -212,8 +212,8 @@ def test_step_name_step_type(log_format):
with mock.patch.dict(
os.environ,
{
"VDK_LOGGING_METADATA": "vdk_step_type",
"VDK_LOGGING_FORMAT": log_format,
"VDK_STRUCTLOG_METADATA": "vdk_step_type",
"VDK_STRUCTLOG_FORMAT": log_format,
},
):
logs = _run_job_and_get_logs()
Expand Down