Skip to content

Commit 1005e93

Browse files
Merge pull request #5 from fleetingbytes/develop
Develop
2 parents 03d1047 + 8151146 commit 1005e93

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

.github/workflows/test-e2e.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,8 @@ jobs:
7070
- name: Test | Run pytest
7171
run: ${{ inputs.run-test-command }}
7272

73+
- name: Test | Run End-to-End App Test
74+
run: ./tests/e2e_test_app.py
75+
76+
- name: Test | Check End-to-End Test Results
77+
run: [ "$(wc -l < e2e-test-app-stderr.log)" -eq 3 ] && [ "$(wc -l < e2e-test-logfile.log)" -eq 3 ] && [ ! -s "e2e-test-logfile_root.log" ]

src/readylog/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55

66

77
def create_dict_config(
8-
logfile: Path,
8+
logfile: Path | str,
99
app_name: str,
1010
console_log_level: str | int = "WARNING",
1111
file_log_level: str | int = "DEBUG",
1212
console_handler_factory: Callable = StreamHandler,
1313
file_handler_factory: Callable = FileHandler,
1414
) -> dict[str, str]:
15+
logfile = Path(logfile)
1516
console_log_level = _checkLevel(console_log_level)
1617
file_log_level = _checkLevel(file_log_level)
1718
min_level = getLevelName(min(console_log_level, file_log_level))

tests/e2e_test_app.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env -S uv run --script
2+
#
3+
# /// script
4+
# requires-python = ">=3.11"
5+
# dependencies = [
6+
# "readylog",
7+
# ]
8+
#
9+
# [tool.uv.sources]
10+
# readylog = { path = "..", editable = true }
11+
# ///
12+
13+
from logging import getLogger
14+
from logging.config import dictConfig
15+
16+
from readylog import create_dict_config
17+
from readylog.decorators import debug
18+
19+
logging_configuration = create_dict_config(
20+
"e2e-test-logfile.log", "e2e-test-app", console_log_level="DEBUG"
21+
)
22+
dictConfig(logging_configuration)
23+
24+
logger = getLogger(__name__)
25+
26+
27+
@debug
28+
def greet(greeting: str, name: str) -> None:
29+
return f"{greeting.title()}, {name.title()}"
30+
31+
32+
logger.debug("e2e-test-app runs")
33+
34+
greet("hello", "world")

0 commit comments

Comments
 (0)