Skip to content

Commit

Permalink
Remove "notifier" and its dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan committed Dec 8, 2018
1 parent a9b6ff8 commit 7e9879c
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 396 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Unreleased
==========

- Remove the ``notifier`` and its dependencies, just ``pip install notifiers`` if user needs it


0.1.0 (2018-12-07)
==================

Expand Down
18 changes: 10 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ Take the tour
.. |parser| replace:: ``parser``
.. _parser: https://loguru.readthedocs.io/en/stable/api/parser.html#loguru._parser.Parser

.. |notifier| replace:: ``notifier``
.. _notifier: https://loguru.readthedocs.io/en/stable/api/notifier.html#loguru._notifier.Notifier

.. |start| replace:: ``start()``
.. _start: https://loguru.readthedocs.io/en/stable/api/logger.html#loguru._logger.Logger.start

Expand Down Expand Up @@ -115,6 +112,9 @@ Take the tour
.. _fixes it: https://loguru.readthedocs.io/en/stable/api/logger.html#time
.. _No problem: https://loguru.readthedocs.io/en/stable/api/logger.html#env

.. |notifiers| replace:: ``notifiers``
.. _notifiers: https://pypi.org/project/notifiers/

Ready to use out of the box without boilerplate
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -393,19 +393,21 @@ It is often useful to extract specific information from generated logs, this is
Exhaustive notifier
^^^^^^^^^^^^^^^^^^^

Receive an e-mail when your program fail unexpectedly or send many other kind of notifications using `Loguru` |notifier|_.
`Loguru` can easily be combined with the great |notifiers|_ library (must be installed separately) to receive an e-mail when your program fail unexpectedly or to send many other kind of notifications.

::

from loguru import notifier
import notifiers

gmail_notifier = notifier.gmail(to="dest@gmail.com", username="you@gmail.com", password="abc123")
def send_mail(message):
g = notifiers.get_notifier('gmail')
g.notify(message=message, to="dest@gmail.com", username="you@gmail.com", password="abc123")

# Send a notification
gmail_notifier.send("The application is running!")
send_mail("The application is running!")

# Be alerted on each error messages
logger.start(gmail_notifier.send, level="ERROR")
logger.start(send_mail, level="ERROR")


|strike|
Expand Down
1 change: 0 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ API Reference
:includehidden:

api/logger.rst
api/notifier.rst
api/parser.rst
8 changes: 0 additions & 8 deletions docs/api/notifier.rst

This file was deleted.

4 changes: 1 addition & 3 deletions loguru/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
"""
The Loguru library provides pre-instanced objects to facilitate dealing with logging in Python.
Pick one: ``from loguru import logger, notifier, parser``
Pick one: ``from loguru import logger, parser``
"""
import atexit as _atexit
import sys as _sys

from . import _defaults
from ._logger import Logger as _Logger
from ._notifier import Notifier as _Notifier
from ._parser import Parser as _Parser

__version__ = "0.1.0"

logger = _Logger({}, None, False, False, False, False, 0)
notifier = _Notifier()
parser = _Parser()

if _defaults.LOGURU_AUTOINIT and _sys.stderr:
Expand Down
2 changes: 1 addition & 1 deletion loguru/_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from calendar import day_abbr, day_name, month_abbr, month_name
from datetime import datetime as datetime_
from datetime import timedelta, timezone
from time import localtime, time
from time import localtime

tokens = r"H{1,2}|h{1,2}|m{1,2}|s{1,2}|S{1,6}|YYYY|YY|M{1,4}|D{1,4}|Z{1,2}|zz|A|X|x|E|Q|dddd|ddd|d"

Expand Down
1 change: 0 additions & 1 deletion loguru/_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
import threading
from collections import namedtuple
from datetime import timedelta
from inspect import isclass
from multiprocessing import current_process
from os import PathLike
Expand Down

0 comments on commit 7e9879c

Please sign in to comment.