Skip to content

Commit

Permalink
Update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jlubken committed Jun 2, 2020
1 parent d4d8bfc commit 0e34741
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/dsdk/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,13 @@ def store_evidence(self, batch: Batch, *args, **kwargs) -> None:
df.drop(columns=["batch_id"], inplace=True)


OPEN = '{"key": "mongo.open", "database": "%s", "is_master": "%s" }'
CLOSE = '{"key": "mongo.close", "database": "%s"}'
OPEN = "".join(
("{", ", ".join(('"key": "mongo.open"', '"database": "%s"',)), "}",)
)

CLOSE = "".join(
("{", ", ".join(('"key": "mongo.close"', '"database": "%s"',)), "}",)
)


@contextmanager
Expand Down Expand Up @@ -186,8 +191,8 @@ def open_database(
) as client:
database = client.get_database()
# force lazy connection open
is_master = client.admin.command("ismaster")
logger.info(OPEN, database.name, is_master)
client.admin.command("ismaster")
logger.info(OPEN, database.name)
try:
yield database
finally:
Expand Down
4 changes: 2 additions & 2 deletions src/dsdk/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ def _inject_mssql_uri(mssql_uri: str) -> str:
type=_inject_mssql_uri,
)

OPEN = "".join(("{", ", ".join(('"key": "mssql.open"')), "}"))
OPEN = "".join(("{", ", ".join(('"key": "mssql.open"',)), "}"))

CLOSE = "".join(("{", ", ".join(('"key": "mssql.close"')), "}"))
CLOSE = "".join(("{", ", ".join(('"key": "mssql.close"',)), "}"))

CONNECT = """
select 1 as n
Expand Down

0 comments on commit 0e34741

Please sign in to comment.