Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/picologging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
LogRecord,
StreamHandler,
getLevelName,
raiseExceptions,
)

__version__ = "0.9.3"
Expand Down
2 changes: 2 additions & 0 deletions src/picologging/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ INFO: int
DEBUG: int
NOTSET: int

raiseExceptions: bool

_SysExcInfoType: TypeAlias = Union[
tuple[type[BaseException], BaseException, TracebackType | None],
tuple[None, None, None],
Expand Down
2 changes: 2 additions & 0 deletions src/picologging/_picologging.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ PyMODINIT_FUNC PyInit__picologging(void)
picologging_state *state = get_picologging_state(m);
state->g_filepathCache = new FilepathCache();

PyModule_AddObject(m, "raiseExceptions", Py_NewRef(Py_False));

Py_INCREF(&LogRecordType);
Py_INCREF(&FormatStyleType);
Py_INCREF(&FormatterType);
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/test_picologging.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,10 @@ def test_make_log_record():
@pytest.mark.parametrize("encoding", ["utf-8", None])
def test_basic_config_encoding(encoding):
picologging.basicConfig(filename="test.txt", encoding=encoding)


@pytest.mark.limit_leaks("192B", filter_fn=filter_gc)
def test_raiseExceptions():
assert picologging.raiseExceptions is False
picologging.raiseExceptions = True
assert picologging.raiseExceptions is True