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

Skip to content

Commit b210255

Browse files
committed
Edited README.md via GitHub
1 parent 81ebfaa commit b210255

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
A Python structured logger for Fluent
2+
=====================================
3+
4+
Many web/mobile applications generate huge amount of event logs (c,f. login, logout, purchase, follow, etc). To analyze these event logs could be really valuable for improving the service. However, the challenge is collecting these logs seasily and reliably.
5+
6+
[Fluent](http://github.com/fluent/fluent) solves that problem by having: easy installation, small footprint, plugins, reliable buffering, log forwarding, etc.
7+
8+
**fluent-logger-python** is a Python library, to record the events from Python application.
9+
10+
Installation
11+
------------
12+
13+
This library is distributed as 'fluent-logger' python package. Please execute the following command to install it.
14+
15+
$ pip install fluent-logger
16+
17+
Configuration
18+
-------------
19+
20+
Fluent daemon must be lauched with the following configuration:
21+
22+
<source>
23+
type tcp
24+
port 24224
25+
</source>
26+
27+
Use
28+
---
29+
30+
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.
31+
32+
By default, the logger assumes fluent daemon is launched locally. You can also specify remote logger by passing the options.
33+
34+
from fluent import logger
35+
36+
# for local fluent
37+
logger.setup('app')
38+
39+
# for remote fluent
40+
logger.setup('app', server='host', port='24224')
41+
42+
Then, please create the events like this. This will send the event to fluent, with tag 'app.follow' and the attributes 'from' and 'to'.
43+
44+
from fluent import event
45+
46+
# send event with tag app.follow
47+
event.Event('follow', {
48+
'from': 'userA',
49+
'to': 'userB'
50+
})
51+
52+
License
53+
-------
54+
55+
Apache License, Version 2.0

0 commit comments

Comments
 (0)
0