Skip to content

Commit 98b96d2

Browse files
committed
chore: cleanup logging
1 parent 50964ee commit 98b96d2

File tree

5 files changed

+12
-24
lines changed

5 files changed

+12
-24
lines changed

airbyte-integrations/connectors/destination-glide/destination_glide/destination.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from .glide import Column, GlideBigTableFactory
1818
import json
19-
from .log import getLogger
19+
from .log import LOG_LEVEL_DEFAULT
2020
import logging
2121
import requests
2222
from typing import Any, Iterable, Mapping
@@ -25,7 +25,8 @@
2525
CONFIG_GLIDE_API_VERSION_DEFAULT = "tables"
2626
CONFIG_GLIDE_API_HOST_DEFAULT = "https://api.glideapp.io"
2727

28-
logger = getLogger()
28+
logger = logging.getLogger(__name__)
29+
logger.setLevel(LOG_LEVEL_DEFAULT)
2930

3031

3132
def mapJsonSchemaTypeToGlideType(json_type: str) -> str:

airbyte-integrations/connectors/destination-glide/destination_glide/glide.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from abc import ABC, abstractmethod
2+
from .log import LOG_LEVEL_DEFAULT
3+
import logging
24
import requests
35
from typing import Dict, Any, Iterator, List
46

5-
from .log import getLogger
6-
7-
logger = getLogger()
7+
logger = logging.getLogger(__name__)
8+
logger.setLevel(LOG_LEVEL_DEFAULT)
89

910
BigTableRow = Dict[str, Any]
1011

@@ -201,6 +202,7 @@ def finalize_stash(self) -> None:
201202
r.raise_for_status()
202203
except Exception as e:
203204
raise Exception(f"failed to finalize stash") from e # nopep8
205+
logger.info(f"Successfully finalized record stash for table '{self.table_id}' (stash ID '{self.stash_id}')")
204206

205207
def commit(self) -> None:
206208
self.raise_if_set_schema_not_called()
Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
11

22
import logging
33

4-
# Create a logger
5-
6-
logger = logging.getLogger("destination-glide")
7-
logger.setLevel(logging.DEBUG)
8-
9-
# Create a file handler
10-
# TODO REMOVE?
11-
handler = logging.FileHandler('destination-glide.log')
12-
handler.setLevel(logging.INFO)
13-
# Create a logging format
14-
formatter = logging.Formatter(
15-
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
16-
handler.setFormatter(formatter)
17-
# Add the handlers to the logger
18-
logger.addHandler(handler)
19-
20-
def getLogger() -> logging.Logger:
21-
return logger
4+
LOG_LEVEL_DEFAULT = logging.INFO

airbyte-integrations/connectors/destination-glide/todo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- [+] fix: "add rows failed with status 400: {"message":"More than 500 mutations"}" in mutation api (batch them to ~100 or something)
55
- [+] fix: batch row adds in rest api
66
- [+] chore: unify test framework across unit/integration tests (remove pytest?)
7-
- [+] feat: snuggle rows in batch
7+
- [+] feat: snuggle rows in a batch
88
- [ ] feat: support multiple streams from source by using a naming convention and discovering existing tables with GET /tables
99
- [ ] fix: replace "hostname" and "path" configs with "baseUrl"
1010
- [ ] feat: verify actual host/api/auth connection in check: https://docs.airbyte.com/understanding-airbyte/airbyte-protocol#check

airbyte-integrations/connectors/destination-glide/unit_tests/destination_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from datetime import datetime
1414
from destination_glide import DestinationGlide
1515
from destination_glide.glide import GlideBigTableBase, GlideBigTableFactory
16+
from destination_glide.log import LOG_LEVEL_DEFAULT
1617
import json
1718
import logging
1819
import random
@@ -48,6 +49,7 @@ def table_schema() -> str:
4849

4950
def AirbyteLogger() -> logging.Logger:
5051
logger = logging.getLogger('airbyte')
52+
logger.setLevel(LOG_LEVEL_DEFAULT)
5153

5254

5355
def configured_catalog(test_table_name: str, table_schema: str) -> ConfiguredAirbyteCatalog:

0 commit comments

Comments
 (0)