Skip to content

Commit c800cf7

Browse files
committed
1.3.0 Added educational mode
1 parent 893e9f1 commit c800cf7

File tree

11 files changed

+789
-97
lines changed

11 files changed

+789
-97
lines changed

CHANGELOG.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,74 @@
11
# Changelog
22

3+
## [1.3.0] - 2026-03-24
4+
5+
### Added
6+
7+
* **Educational logging mode (`mode="edu"`)**
8+
9+
* Human-readable, step-by-step output for learning and algorithm tracing
10+
* Function calls rendered as:
11+
12+
```
13+
Calling foo(1, b=2)
14+
```
15+
* Automatic argument formatting (args + kwargs)
16+
* Omits empty kwargs
17+
18+
* **Nested function call tracing**
19+
20+
* Logs calls inside functions (e.g. `outer.inner()`)
21+
22+
* **Context-aware logging**
23+
24+
* `log()` inside decorated functions now inherits:
25+
26+
* `mode`
27+
* `show_time`
28+
* `show_file`
29+
* `show_lineno`
30+
31+
### Improved
32+
33+
* **Output clarity in educational mode**
34+
35+
* Removed internal noise (`<func ...>`, debug artifacts)
36+
* Simplified function names (no test/module prefixes)
37+
* More natural mutation messages:
38+
39+
```
40+
Added 5 to arr -> [1, 2, 5]
41+
```
42+
43+
### Fixed
44+
45+
* Formatter crash (`UnboundLocalError: prefix`)
46+
* Incorrect call argument display (`{'args': ..., 'kwargs': ...}`)
47+
* Missing nested call events due to tracer scope issues
48+
49+
### Tests
50+
51+
* Added educational mode test coverage:
52+
53+
* Call formatting
54+
* Argument rendering
55+
* Nested function tracing
56+
* Inherited logging behavior
57+
* Human-readable mutations
58+
* Output cleanliness
59+
360
## [1.2.0] - 2026-03-23
461
562
### Added
63+
664
- `@log(level=...)` for verbosity control (`call`, `state`, `full`)
765
- `@log(filter=[...])` to log only selected variables
866
- Per-function file logging via `@log(filepath=...)`
967
- Global file logging support
1068
- Decorator-only logging mode toggle
1169
1270
### Improved
71+
1372
- Overall logging flexibility and usability
1473
- Reduced noise in complex traces
1574
@@ -18,34 +77,39 @@
1877
## [1.1.5] - 2026-03-23
1978
2079
### Changed
80+
2181
- Updated README documentation
2282
2383
---
2484
2585
## [1.1.4] - 2026-03-23
2686
2787
### Fixed
88+
2889
- Class wrapping issues
2990
3091
---
3192
3293
## [1.1.3] - 2026-03-23
3394
3495
### Fixed
96+
3597
- Wrapped object representation
3698
3799
---
38100
39101
## [1.1.2] - 2026-03-23
40102
41103
### Fixed
104+
42105
- Incorrect wrapping of callables
43106
44107
---
45108
46109
## [1.1.1] - 2026-03-23
47110
48111
### Fixed
112+
49113
- Mutation tracking issues
50114
- Nested path logging bugs
51115
- Test failures
@@ -55,16 +119,19 @@
55119
## [1.1.0] - 2026-03-23
56120
57121
### Added
122+
58123
- Mutation logging support for tracked objects
59124
60125
### Improved
126+
61127
- Core logging capabilities
62128
63129
---
64130
65131
## [1.0.0] - 2026-03-23
66132
67133
### Added
134+
68135
- Initial release
69136
- Variable logging with name inference
70137
- Function tracing

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![PyPI](https://img.shields.io/pypi/v/logeye?cachebust=RANDOM)
1+
![PyPI](https://img.shields.io/pypi/v/logeye?cachebust=1774323493)
22
![Python](https://img.shields.io/pypi/pyversions/logeye)
33
![License](https://img.shields.io/github/license/MattFor/LogEye)
44

@@ -510,5 +510,5 @@ MIT License © 2026
510510

511511
See [LICENSE](LICENSE) for details.
512512

513-
Version 1.2.0
513+
Version 1.3.0
514514

demo/demo_educational.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from logeye import log
2+
3+
4+
@log(mode="edu")
5+
def radix_sort_lsd(arr):
6+
if not arr:
7+
return arr
8+
9+
max_num = max(arr)
10+
exp = 1 # 1, 10, 100...
11+
12+
while max_num // exp > 0:
13+
buckets = [[] for _ in range(10)]
14+
15+
# Distribute into buckets
16+
for num in arr:
17+
digit = (num // exp) % 10
18+
buckets[digit].append(num)
19+
20+
# Collect back
21+
arr = []
22+
for i, bucket in enumerate(buckets):
23+
arr.extend(bucket)
24+
25+
# Wrapper options automatically passed here!!!!
26+
log("After pass: $arr")
27+
28+
exp *= 10
29+
30+
return arr
31+
32+
33+
if __name__ == "__main__":
34+
data = [170, 45, 75, 90, 802, 24, 2, 66]
35+
36+
sorted_data = radix_sort_lsd(data)
37+
38+
# Match pretty output
39+
log("Sorted: $sorted_data", show_file=False, show_lineno=False)

logeye/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from .core import log, watch
55
from .formatting import set_output_formatter, reset_output_formatter
66
from .config import toggle_logs, toggle_decorator_log_only, toggle_message_metadata, toggle_global_log_file, \
7-
set_path_mode, set_global_log_file
7+
set_path_mode, set_global_log_file, _normalize_mode
88

99
w = watch
1010

logeye/config.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
# Whether message logs include timestamp + file info
1313
_SHOW_MESSAGE_META = True
1414
_DECORATORS_ONLY = False
15+
_LOG_MODE = "full" # "full" | "educational"
16+
17+
_SHOW_TIME = True
18+
_SHOW_FILE = True
19+
_SHOW_LINENO = True
1520

1621
_PROJECT_ROOT = os.getcwd()
1722
_LIBRARY_ROOT = os.path.dirname(__file__)
@@ -80,3 +85,17 @@ def set_path_mode(mode: str):
8085
raise ValueError("mode must be: absolute, project, file")
8186

8287
_PATH_MODE = mode
88+
89+
90+
# =========
91+
# OTHER
92+
# =========
93+
94+
def _normalize_mode(mode: str) -> str:
95+
if mode in ("edu", "educational"):
96+
return "educational"
97+
98+
if mode == "full":
99+
return "full"
100+
101+
raise ValueError("mode must be: full, edu, educational")

0 commit comments

Comments
 (0)