Skip to content

Commit dcfee05

Browse files
committed
logging-interface-handle-buffer-overflow Updated the README to include a buffer overflow example
1 parent 3ab3aa2 commit dcfee05

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
/.tox
1010
/build
1111
/dist
12-
/.idea
12+
.idea/

README.rst

+12
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,18 @@ You can also customize formatter via logging.config.dictConfig
211211
212212
logging.config.dictConfig(conf['logging'])
213213
214+
You can inject your own custom proc to handle buffer overflow in the event of connection failure. This will mitigate the loss of data instead of simply throwing data away.
215+
216+
.. code:: python
217+
218+
import msgpack
219+
from io import BytesIO
220+
221+
def handler(pendings):
222+
unpacker = msgpack.Unpacker(BytesIO(pendings))
223+
for unpacked in unpacker:
224+
print(unpacked)
225+
214226
A sample configuration ``logging.yaml`` would be:
215227

216228
.. code:: python

0 commit comments

Comments
 (0)