Skip to content

Commit

Permalink
Replace "notifiers" (seems unmaintained) with "apprise" in docs (#1251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan authored Dec 5, 2024
1 parent a372814 commit ccca356
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,26 +363,22 @@ for groups in logger.parse("file.log", pattern, cast=caster_dict):

### Exhaustive notifier

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.
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.

```python
import notifiers
import apprise

params = {
"username": "[email protected]",
"password": "abc123",
"to": "[email protected]"
}

# Send a single notification
notifier = notifiers.get_notifier("gmail")
notifier.notify(message="The application is running!", **params)
# Define the configuration constants.
WEBHOOK_ID = "123456790"
WEBHOOK_TOKEN = "abc123def456"

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

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

<s>
Expand Down

0 comments on commit ccca356

Please sign in to comment.