Skip to content

Commit

Permalink
Update README examples
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyZmeem committed Nov 4, 2019
1 parent d5ffac9 commit f4a5e49
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import logging_loki
handler = logging_loki.LokiHandler(
url="https://my-loki-instance/loki/api/v1/push",
tags={"application": "my-app"},
auth=("username", "password"),
auth=("username", "password"),
version="1",
)

logger = logging.getLogger("my-logger")
Expand All @@ -49,15 +50,16 @@ But you can use the built-in `QueueHandler` and` QueueListener` to send messages
```python
import logging.handlers
import logging_loki
from queue import Queue
from multiprocessing import Queue


queue = Queue(-1)
handler = logging.handlers.QueueHandler(queue)
handler_loki = logging_loki.LokiHandler(
url="https://my-loki-instance/loki/api/v1/push",
tags={"application": "my-app"},
auth=("username", "password"),
auth=("username", "password"),
version="1",
)
logging.handlers.QueueListener(queue, handler_loki)

Expand All @@ -71,14 +73,15 @@ Or you can use `LokiQueueHandler` shortcut, which will automatically create list
```python
import logging.handlers
import logging_loki
from queue import Queue
from multiprocessing import Queue


handler = logging_loki.LokiQueueHandler(
Queue(-1),
url="https://my-loki-instance/loki/api/v1/push",
tags={"application": "my-app"},
auth=("username", "password"),
version="1",
)

logger = logging.getLogger("my-logger")
Expand Down

0 comments on commit f4a5e49

Please sign in to comment.