Skip to content

Commit

Permalink
Merge branch 'master' into pypi_action
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Hirsch committed Nov 22, 2023
2 parents 307d91f + 1afacc5 commit 06438ad
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-mojap-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [3.8, 3.9]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Set up Python
uses: actions/setup-python@v2
Expand Down
39 changes: 21 additions & 18 deletions dataengineeringutils3/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,31 @@ def get_logger(
returns a logger object and an io stream of the data that is logged
"""

log = logging.getLogger()
log = logging.getLogger("root")
log.setLevel(logging.DEBUG)

# for some reason, log.hasHandlers doesn't work below <3.9
if not log.handlers:
# set the io handler
log_stringio = io.StringIO()
io_handler = logging.StreamHandler(log_stringio)
# set the console output
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
# add the handlers
log.addHandler(io_handler)
log.addHandler(console_handler)
else:
# this relies on the StringIO logger being added first (which we did do above)
log_stringio = log.handlers[0].stream
log_stringio = io.StringIO()
handler = logging.StreamHandler(log_stringio)

log_formatter = logging.Formatter(fmt=fmt, datefmt=datefmt)
handler.setFormatter(log_formatter)
log.addHandler(handler)

# add the formatters
for log_handler in log.handlers:
log_handler.setFormatter(log_formatter)
# Add console output
console = logging.StreamHandler()
console.setLevel(logging.INFO)
console.setFormatter(log_formatter)
log.addHandler(console)

return log, log_stringio


def add_stream_handlers(log: logging.Logger):
log_stringio = io.StringIO()
io_handler = logging.StreamHandler(log_stringio)
# set the console output
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
# add the handlers
log.addHandler(io_handler)
log.addHandler(console_handler)
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Deprecated = "^1.2.12"
PyYAML = "^6.0"

[tool.poetry.dev-dependencies]
pytest = ">=3.4"
pytest = "^7.4"
moto = "^2.2.6"
pytest-cov = "^2.8"
jsonlines = "^1.2"
Expand Down

0 comments on commit 06438ad

Please sign in to comment.