Skip to content

Commit ccca356

Browse files
authored
Replace "notifiers" (seems unmaintained) with "apprise" in docs (#1251)
1 parent a372814 commit ccca356

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

README.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -363,26 +363,22 @@ for groups in logger.parse("file.log", pattern, cast=caster_dict):
363363

364364
### Exhaustive notifier
365365

366-
Loguru can easily be combined with the great [`notifiers`](https://github.com/notifiers/notifiers) library (must be installed separately) to receive an e-mail when your program fail unexpectedly or to send many other kind of notifications.
366+
Loguru can easily be combined with the great [`apprise`](https://github.com/caronc/apprise) library (must be installed separately) to receive an e-mail when your program fail unexpectedly or to send many other kind of notifications.
367367

368368
```python
369-
import notifiers
369+
import apprise
370370

371-
params = {
372-
"username": "[email protected]",
373-
"password": "abc123",
374-
375-
}
376-
377-
# Send a single notification
378-
notifier = notifiers.get_notifier("gmail")
379-
notifier.notify(message="The application is running!", **params)
371+
# Define the configuration constants.
372+
WEBHOOK_ID = "123456790"
373+
WEBHOOK_TOKEN = "abc123def456"
380374

381-
# Be alerted on each error message
382-
from notifiers.logging import NotificationHandler
375+
# Prepare the object to send Discord notifications.
376+
notifier = apprise.Apprise()
377+
notifier.add(f"discord://{WEBHOOK_ID}/{WEBHOOK_TOKEN}")
383378

384-
handler = NotificationHandler("gmail", defaults=params)
385-
logger.add(handler, level="ERROR")
379+
# Install a handler to be alerted on each error.
380+
# You can filter out logs from "apprise" itself to avoid recursive calls.
381+
logger.add(notifier.notify, level="ERROR", filter={"apprise": False})
386382
```
387383

388384
<s>

0 commit comments

Comments
 (0)