8000 Edited README.md via GitHub · ludwick/fluent-logger-python@d5e370c · GitHub
[go: up one dir, main page]

Skip to content

Commit d5e370c

Browse files
committed
Edited README.md via GitHub
1 parent 9b2f75b commit d5e370c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Fluent daemon must be lauched with the following configuration:
2727
Usage
2828
-----
2929

30+
Event-Based Interface
31+
^^^^^^^^^^^^^^^^^^^^^
32+
3033
First, you need to call logger.setup() to create global logger instance. This call needs to be called only once, at the beggining of the application for example.
3134

3235
By default, the logger assumes fluent daemon is launched locally. You can also specify remote logger by passing the options.
@@ -48,6 +51,22 @@ Then, please create the events like this. This will send the event to fluent, wi
4851
'from': 'userA',
4952
'to': 'userB'
5053
})
54+
55+
Python logging.Handler interface
56+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57+
58+
This client-library also has FluentHanler class for Python logging module.
59+
60+
import logging
61+
from fluent import handler
62+
63+
logging.basicConfig(level=logging.INFO)
64+
l = logging.getLogger('fluent.test')
65+
l.addHandler(handler.FluentHandler('app.follow'))
66+
l.info({
67+
'from': 'userA',
68+
'to': 'userB'
69+
})
5170

5271
License
5372
-------

0 commit comments

Comments
 (0)
0