airbyte-cdk 6.60.12__py3-none-any.whl → 6.60.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airbyte_cdk/entrypoint.py +2 -2
- airbyte_cdk/logger.py +21 -3
- {airbyte_cdk-6.60.12.dist-info → airbyte_cdk-6.60.13.dist-info}/METADATA +1 -1
- {airbyte_cdk-6.60.12.dist-info → airbyte_cdk-6.60.13.dist-info}/RECORD +8 -8
- {airbyte_cdk-6.60.12.dist-info → airbyte_cdk-6.60.13.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.60.12.dist-info → airbyte_cdk-6.60.13.dist-info}/LICENSE_SHORT +0 -0
- {airbyte_cdk-6.60.12.dist-info → airbyte_cdk-6.60.13.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.60.12.dist-info → airbyte_cdk-6.60.13.dist-info}/entry_points.txt +0 -0
airbyte_cdk/entrypoint.py
CHANGED
@@ -22,7 +22,7 @@ from requests import PreparedRequest, Response, Session
|
|
22
22
|
|
23
23
|
from airbyte_cdk.connector import TConfig
|
24
24
|
from airbyte_cdk.exception_handler import init_uncaught_exception_handler
|
25
|
-
from airbyte_cdk.logger import PRINT_BUFFER, init_logger
|
25
|
+
from airbyte_cdk.logger import PRINT_BUFFER, init_logger, is_platform_debug_log_enabled
|
26
26
|
from airbyte_cdk.models import (
|
27
27
|
AirbyteConnectionStatus,
|
28
28
|
AirbyteMessage,
|
@@ -158,7 +158,7 @@ class AirbyteEntrypoint(object):
|
|
158
158
|
if not cmd:
|
159
159
|
raise Exception("No command passed")
|
160
160
|
|
161
|
-
if hasattr(parsed_args, "debug") and parsed_args.debug:
|
161
|
+
if (hasattr(parsed_args, "debug") and parsed_args.debug) or is_platform_debug_log_enabled():
|
162
162
|
self.logger.setLevel(logging.DEBUG)
|
163
163
|
logger.setLevel(logging.DEBUG)
|
164
164
|
self.logger.debug("Debug logs enabled")
|
airbyte_cdk/logger.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
3
|
#
|
4
|
-
|
5
4
|
import json
|
6
5
|
import logging
|
7
6
|
import logging.config
|
7
|
+
import os
|
8
8
|
from typing import Any, Callable, Mapping, Optional, Tuple
|
9
9
|
|
10
10
|
import orjson
|
@@ -40,6 +40,10 @@ LOGGING_CONFIG = {
|
|
40
40
|
}
|
41
41
|
|
42
42
|
|
43
|
+
def is_platform_debug_log_enabled() -> bool:
|
44
|
+
return os.environ.get("LOG_LEVEL", "info").lower() == "debug"
|
45
|
+
|
46
|
+
|
43
47
|
def init_logger(name: Optional[str] = None) -> logging.Logger:
|
44
48
|
"""Initial set up of logger"""
|
45
49
|
logger = logging.getLogger(name)
|
@@ -73,8 +77,22 @@ class AirbyteLogFormatter(logging.Formatter):
|
|
73
77
|
airbyte_level = self.level_mapping.get(record.levelno, "INFO")
|
74
78
|
if airbyte_level == Level.DEBUG:
|
75
79
|
extras = self.extract_extra_args_from_record(record)
|
76
|
-
|
77
|
-
|
80
|
+
if is_platform_debug_log_enabled():
|
81
|
+
# We have a different behavior between debug logs enabled through `--debug` argument and debug logs
|
82
|
+
# enabled through environment variable. The reason is that for platform logs, we need to have these
|
83
|
+
# printed as AirbyteMessage which is not the case with the current previous implementation.
|
84
|
+
# Why not migrate both to AirbyteMessages then? AirbyteMessages do not support having structured logs.
|
85
|
+
# which means that the DX would be degraded compared to the current solution (devs will need to identify
|
86
|
+
# the `log.message` field and figure out where in this field is the response while the current solution
|
87
|
+
# have a specific field that is structured for extras.
|
88
|
+
message = f"{filter_secrets(record.getMessage())} ///\nExtra logs: {filter_secrets(json.dumps(extras))}"
|
89
|
+
log_message = AirbyteMessage(
|
90
|
+
type=Type.LOG, log=AirbyteLogMessage(level=airbyte_level, message=message)
|
91
|
+
)
|
92
|
+
return orjson.dumps(AirbyteMessageSerializer.dump(log_message)).decode()
|
93
|
+
else:
|
94
|
+
debug_dict = {"type": "DEBUG", "message": record.getMessage(), "data": extras}
|
95
|
+
return filter_secrets(json.dumps(debug_dict))
|
78
96
|
else:
|
79
97
|
message = super().format(record)
|
80
98
|
message = filter_secrets(message)
|
@@ -34,9 +34,9 @@ airbyte_cdk/destinations/vector_db_based/indexer.py,sha256=beiSi2Uu67EoTr7yQSaCJ
|
|
34
34
|
airbyte_cdk/destinations/vector_db_based/test_utils.py,sha256=MkqLiOJ5QyKbV4rNiJhe-BHM7FD-ADHQ4bQGf4c5lRY,1932
|
35
35
|
airbyte_cdk/destinations/vector_db_based/utils.py,sha256=FOyEo8Lc-fY8UyhpCivhZtIqBRyxf3cUt6anmK03fUY,1127
|
36
36
|
airbyte_cdk/destinations/vector_db_based/writer.py,sha256=nZ00xPiohElJmYktEZZIhr0m5EDETCHGhg0Lb2S7A20,5095
|
37
|
-
airbyte_cdk/entrypoint.py,sha256=
|
37
|
+
airbyte_cdk/entrypoint.py,sha256=dxPRrHJGQfkLmno-n3AF-J0cHgKDoTtG6PwPMNEFB7o,19842
|
38
38
|
airbyte_cdk/exception_handler.py,sha256=D_doVl3Dt60ASXlJsfviOCswxGyKF2q0RL6rif3fNks,2013
|
39
|
-
airbyte_cdk/logger.py,sha256=
|
39
|
+
airbyte_cdk/logger.py,sha256=V8E7yO4RerDkyELzFv-NCJx4vEp9dhMkGAbfOnn9Krc,5080
|
40
40
|
airbyte_cdk/manifest_migrations/README.md,sha256=YX1h0xyc4jHdwH3I25ZHqB7R3hcUUCHMvnexpfzF2E8,3020
|
41
41
|
airbyte_cdk/manifest_migrations/__init__.py,sha256=0eq9ic_6GGXMwzE31eAOSA7PLtBauMfgM9XshjYHF84,61
|
42
42
|
airbyte_cdk/manifest_migrations/exceptions.py,sha256=mmMZaCVEkYSGykVL5jKA0xsDWWkybRdQwnh9pGb7VG0,300
|
@@ -424,9 +424,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
|
|
424
424
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
|
425
425
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
426
426
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
427
|
-
airbyte_cdk-6.60.
|
428
|
-
airbyte_cdk-6.60.
|
429
|
-
airbyte_cdk-6.60.
|
430
|
-
airbyte_cdk-6.60.
|
431
|
-
airbyte_cdk-6.60.
|
432
|
-
airbyte_cdk-6.60.
|
427
|
+
airbyte_cdk-6.60.13.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
428
|
+
airbyte_cdk-6.60.13.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
|
429
|
+
airbyte_cdk-6.60.13.dist-info/METADATA,sha256=Zy-y3rjiuGIGzc3BLW-7F8zJJAxZMsX85KCPZHIxUXc,6478
|
430
|
+
airbyte_cdk-6.60.13.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
431
|
+
airbyte_cdk-6.60.13.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
|
432
|
+
airbyte_cdk-6.60.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|