Skip to content

Commit

Permalink
Updated embeddings logger to match cdc simple import formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dwnoble committed Dec 19, 2024
1 parent 4d941b0 commit 396c6a9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/nl/embeddings/build_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,22 @@


def _init_logger():
# Remove existing handlers from root handler that were set by absl library
for handler in logging.root.handlers:
logging.root.removeHandler(handler)

# Log to stdout for easy redirect of the output text.
# This enables the logs to be captured by the admin tool.
logger = logging.getLogger()
logger.setLevel(logging.INFO)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)

# Create a formatter to format the log messages
formatter = logging.Formatter(
"[%(asctime)s %(levelname)s %(filename)s:%(lineno)d] %(message)s")
handler.setFormatter(formatter)

# Add the handler to the logger
logger.addHandler(handler)


Expand Down

0 comments on commit 396c6a9

Please sign in to comment.