Skip to content

Commit

Permalink
Merge pull request #87 from yoichi/overflow-handler-example
Browse files Browse the repository at this point in the history
avoid invalid use of buffer_overflow_handler in the example
  • Loading branch information
repeatedly authored May 18, 2017
2 parents 0058274 + 15aacb6 commit 1c69535
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ You can inject your own custom proc to handle buffer overflow in the event of co
import msgpack
from io import BytesIO
def handler(pendings):
def overflow_handler(pendings):
unpacker = msgpack.Unpacker(BytesIO(pendings))
for unpacked in unpacker:
print(unpacked)
logger = sender.FluentSender('app', host='host', port=24224, buffer_overflow_handler=handler)
logger = sender.FluentSender('app', host='host', port=24224, buffer_overflow_handler=overflow_handler)
You should handle any exception in handler. fluent-logger ignores exceptions from ``buffer_overflow_handler``.

Expand All @@ -198,7 +198,7 @@ module.
logging.basicConfig(level=logging.INFO)
l = logging.getLogger('fluent.test')
h = handler.FluentHandler('app.follow', host='host', port=24224, buffer_overflow_handler=handler)
h = handler.FluentHandler('app.follow', host='host', port=24224, buffer_overflow_handler=overflow_handler)
formatter = handler.FluentRecordFormatter(custom_format)
h.setFormatter(formatter)
l.addHandler(h)
Expand Down Expand Up @@ -228,7 +228,7 @@ You can inject your own custom proc to handle buffer overflow in the event of co
import msgpack
from io import BytesIO
def handler(pendings):
def overflow_handler(pendings):
unpacker = msgpack.Unpacker(BytesIO(pendings))
for unpacked in unpacker:
print(unpacked)
Expand Down Expand Up @@ -264,7 +264,7 @@ A sample configuration ``logging.yaml`` would be:
host: localhost
port: 24224
tag: test.logging
buffer_overflow_handler: handler
buffer_overflow_handler: overflow_handler
formatter: fluent_fmt
level: DEBUG
none:
Expand Down

0 comments on commit 1c69535

Please sign in to comment.