Skip to content

Commit f4a5e49

Browse files
committed
Update README examples
1 parent d5ffac9 commit f4a5e49

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ import logging_loki
2626
handler = logging_loki.LokiHandler(
2727
url="https://my-loki-instance/loki/api/v1/push",
2828
tags={"application": "my-app"},
29-
auth=("username", "password"),
29+
auth=("username", "password"),
30+
version="1",
3031
)
3132

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

5455

5556
queue = Queue(-1)
5657
handler = logging.handlers.QueueHandler(queue)
5758
handler_loki = logging_loki.LokiHandler(
5859
url="https://my-loki-instance/loki/api/v1/push",
5960
tags={"application": "my-app"},
60-
auth=("username", "password"),
61+
auth=("username", "password"),
62+
version="1",
6163
)
6264
logging.handlers.QueueListener(queue, handler_loki)
6365

@@ -71,14 +73,15 @@ Or you can use `LokiQueueHandler` shortcut, which will automatically create list
7173
```python
7274
import logging.handlers
7375
import logging_loki
74-
from queue import Queue
76+
from multiprocessing import Queue
7577

7678

7779
handler = logging_loki.LokiQueueHandler(
7880
Queue(-1),
7981
url="https://my-loki-instance/loki/api/v1/push",
8082
tags={"application": "my-app"},
8183
auth=("username", "password"),
84+
version="1",
8285
)
8386

8487
logger = logging.getLogger("my-logger")

0 commit comments

Comments
 (0)