Skip to content

Commit 067ba83

Browse files
committed
attempt #2
1 parent 7d34283 commit 067ba83

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

airbyte-cdk/python/airbyte_cdk/entrypoint.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from requests import PreparedRequest, Response, Session
4343

4444
logger = init_logger("airbyte")
45-
message_logger = logging.getLogger("messagelogger")
4645

4746
VALID_URL_SCHEMES = ["https"]
4847
CLOUD_DEPLOYMENT_MODE = "cloud"
@@ -264,7 +263,7 @@ def launch(source: Source, args: List[str]) -> None:
264263
for message in source_entrypoint.run(parsed_args):
265264
# simply printing is creating issues for concurrent CDK as Python uses different two instructions to print: one for the message and
266265
# the other for the break line. Adding `\n` to the message ensure that both are printed at the same time
267-
message_logger.info(message)
266+
logger.info(message, extra={"as_is": True})
268267

269268

270269
def _init_internal_request_filter() -> None:

airbyte-cdk/python/airbyte_cdk/logger.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,13 @@
1616
"disable_existing_loggers": False,
1717
"formatters": {
1818
"airbyte": {"()": "airbyte_cdk.logger.AirbyteLogFormatter", "format": "%(message)s"},
19-
"as-is": {"format": "%(message)s"},
2019
},
2120
"handlers": {
2221
"console": {
2322
"class": "logging.StreamHandler",
2423
"stream": "ext://sys.stdout",
2524
"formatter": "airbyte",
2625
},
27-
"console_as-is": {
28-
"class": "logging.StreamHandler",
29-
"stream": "ext://sys.stdout",
30-
"formatter": "as-is",
31-
},
32-
},
33-
"loggers": {
34-
"messagelogger": {
35-
"handlers": ["console_as-is"],
36-
"level": "INFO",
37-
"propagate": False,
38-
}
3926
},
4027
"root": {
4128
"handlers": ["console"],
@@ -74,6 +61,8 @@ class AirbyteLogFormatter(logging.Formatter):
7461
def format(self, record: logging.LogRecord) -> str:
7562
"""Return a JSON representation of the log message"""
7663
airbyte_level = self.level_mapping.get(record.levelno, Level.INFO)
64+
if "as_is" in record.__dict__.keys():
65+
return record.msg
7766
if airbyte_level == Level.DEBUG:
7867
extras = self.extract_extra_args_from_record(record)
7968
debug_dict = {"type": "DEBUG", "message": record.getMessage(), "data": extras}

0 commit comments

Comments
 (0)