Skip to content

Commit 3ab3aa2

Browse files
committed
Enable defining a handler for buffer overflow when using the library as a python logging handler
1 parent 093cc13 commit 3ab3aa2

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
/.tox
1010
/build
1111
/dist
12+
/.idea

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ module.
188188
189189
logging.basicConfig(level=logging.INFO)
190190
l = logging.getLogger('fluent.test')
191-
h = handler.FluentHandler('app.follow', host='host', port=24224)
191+
h = handler.FluentHandler('app.follow', host='host', port=24224, buffer_overflow_handler=handler)
192192
formatter = handler.FluentRecordFormatter(custom_format)
193193
h.setFormatter(formatter)
194194
l.addHandler(h)
@@ -242,6 +242,7 @@ A sample configuration ``logging.yaml`` would be:
242242
host: localhost
243243
port: 24224
244244
tag: test.logging
245+
buffer_overflow_handler: handler
245246
formatter: fluent_fmt
246247
level: DEBUG
247248
none:

fluent/handler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,14 @@ def __init__(self,
115115
host='localhost',
116116
port=24224,
117117
timeout=3.0,
118-
verbose=False):
118+
verbose=False,
119+
buffer_overflow_handler=None):
119120

120121
self.tag = tag
121122
self.sender = sender.FluentSender(tag,
122123
host=host, port=port,
123-
timeout=timeout, verbose=verbose)
124+
timeout=timeout, verbose=verbose,
125+
buffer_overflow_handler=buffer_overflow_handler)
124126
logging.Handler.__init__(self)
125127

126128
def emit(self, record):

0 commit comments

Comments
 (0)