You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,17 +107,13 @@ except RuntimeError as exc:
107
107
truncate_vals=9001)
108
108
```
109
109
110
-
111
-
It's also possible to integrate this neatly with standard logging calls through a bit of extra plumbing. The goal is to use `logging` calls from the standard library without explicitly importing `stackprinter` at the site of the logging call...
110
+
It's also possible to integrate this neatly with standard logging calls through a bit of extra plumbing. The goal is to use the built in `logging` module's error handling method without explicitly importing `stackprinter` at the site of the logging call...
112
111
```python
113
-
logger = logging.getLogger("some_logger")
114
-
115
112
try:
116
113
nothing = {}
117
114
dangerous_function(nothing.get("something"))
118
115
except:
119
116
logger.exception('My hovercraft is full of eels.')
120
-
121
117
```
122
118
...but getting an annotated traceback in the resulting log, still.
123
119
```
@@ -141,10 +137,10 @@ except:
141
137
┆ TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
142
138
```
143
139
144
-
You can achieve this by [adding a custom formatter](https://docs.python.org/3/howto/logging-cookbook.html#customized-exception-formatting) to the logger before using it.
140
+
You can achieve this by adding a [custom formatter](https://docs.python.org/3/howto/logging-cookbook.html#customized-exception-formatting) to the logger beforehand:
0 commit comments