Hello community,

here is the log from the commit of package python-logzero for openSUSE:Factory 
checked in at 2019-04-08 20:53:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-logzero (Old)
 and      /work/SRC/openSUSE:Factory/.python-logzero.new.3908 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-logzero"

Mon Apr  8 20:53:15 2019 rev:6 rq:691800 version:1.5.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-logzero/python-logzero.changes    
2018-12-24 11:39:29.217553531 +0100
+++ /work/SRC/openSUSE:Factory/.python-logzero.new.3908/python-logzero.changes  
2019-04-08 20:53:18.098558031 +0200
@@ -1,0 +2,6 @@
+Fri Apr  5 12:06:37 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 1.5.0:
+  * logzero.syslog(..) (PR 83)
+
+-------------------------------------------------------------------

Old:
----
  logzero-1.4.0.tar.gz

New:
----
  logzero-1.5.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-logzero.spec ++++++
--- /var/tmp/diff_new_pack.BC7wXz/_old  2019-04-08 20:53:20.646559900 +0200
+++ /var/tmp/diff_new_pack.BC7wXz/_new  2019-04-08 20:53:20.706559945 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-logzero
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,26 +17,22 @@
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
-%bcond_without test
 Name:           python-logzero
-Version:        1.4.0
+Version:        1.5.0
 Release:        0
 Summary:        A logging module for Python
 License:        MIT
 Group:          Development/Languages/Python
-Url:            https://github.com/metachris/logzero
+URL:            https://github.com/metachris/logzero
 Source:         
https://files.pythonhosted.org/packages/source/l/logzero/logzero-%{version}.tar.gz
 BuildRequires:  %{python_module pytest-runner}
 BuildRequires:  %{python_module setuptools}
+BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
+BuildArch:      noarch
 # SECTION test requirements
-%if %{with test}
 BuildRequires:  %{python_module pytest}
-%endif
 # /SECTION
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildArch:      noarch
-
 %python_subpackages
 
 %description
@@ -53,21 +49,15 @@
 
 %install
 %python_install
+%python_expand %fdupes %{buildroot}%{$python_sitelib}
 
-%if %{with test}
 %check
 export LANG=en_US.UTF8
 %python_exec setup.py test
-%endif
 
 %files %{python_files}
-%defattr(-,root,root,-)
 %doc AUTHORS.rst README.rst HISTORY.rst
-%if 0%{?leap_version} >= 420200 || 0%{?suse_version} > 1320
 %%license LICENSE
-%else
-%doc LICENSE
-%endif
 %{python_sitelib}/*
 
 %changelog

++++++ logzero-1.4.0.tar.gz -> logzero-1.5.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logzero-1.4.0/HISTORY.rst 
new/logzero-1.5.0/HISTORY.rst
--- old/logzero-1.4.0/HISTORY.rst       2018-03-02 18:02:56.000000000 +0100
+++ new/logzero-1.5.0/HISTORY.rst       2018-03-07 18:03:39.000000000 +0100
@@ -2,7 +2,12 @@
 History
 =======
 
-1.3.1 (2018-03-02)
+1.5.0 (2018-03-07)
+------------------
+* ``logzero.syslog(..)`` (`PR 83 
<https://github.com/metachris/logzero/pull/84>`_)
+
+
+1.4.0 (2018-03-02)
 ------------------
 * Allow Disabling stderr Output (`PR 83 
<https://github.com/metachris/logzero/pull/83>`_)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logzero-1.4.0/PKG-INFO new/logzero-1.5.0/PKG-INFO
--- old/logzero-1.4.0/PKG-INFO  2018-03-02 18:06:06.000000000 +0100
+++ new/logzero-1.5.0/PKG-INFO  2018-03-07 18:04:10.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: logzero
-Version: 1.4.0
+Version: 1.5.0
 Summary: Robust and effective logging for Python 2 and 3
 Home-page: https://github.com/metachris/logzero
 Author: Chris Hager
@@ -25,9 +25,12 @@
             :alt: Documentation Status
         
         .. image:: https://pyup.io/repos/github/metachris/logzero/shield.svg
-             :target: https://pyup.io/repos/github/metachris/logzero/
-             :alt: Updates
+            :target: https://pyup.io/repos/github/metachris/logzero/
+            :alt: Updates
         
+        .. image:: https://anaconda.org/conda-forge/logzero/badges/version.svg
+            :target: https://anaconda.org/conda-forge/logzero
+            :alt: Anaconda-Server Badge
         
         Robust and effective logging for Python 2 and 3.
         
@@ -149,6 +152,13 @@
         If you don't have `pip`_ installed, this `Python installation guide`_ 
can guide
         you through the process.
         
+        Alternatively, if you use the `Anaconda distribution 
<https://www.anaconda.com/download/>`_:
+        
+        .. code-block:: console
+        
+            $ conda config --add channels conda-forge
+            $ conda install logzero
+        
         You can also install `logzero` from the public `Github repo`_:
         
         .. code-block:: console
@@ -184,7 +194,12 @@
         History
         =======
         
-        1.3.1 (2018-03-02)
+        1.5.0 (2018-03-07)
+        ------------------
+        * ``logzero.syslog(..)`` (`PR 83 
<https://github.com/metachris/logzero/pull/84>`_)
+        
+        
+        1.4.0 (2018-03-02)
         ------------------
         * Allow Disabling stderr Output (`PR 83 
<https://github.com/metachris/logzero/pull/83>`_)
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logzero-1.4.0/README.rst new/logzero-1.5.0/README.rst
--- old/logzero-1.4.0/README.rst        2018-03-02 18:02:56.000000000 +0100
+++ new/logzero-1.5.0/README.rst        2018-03-07 18:03:39.000000000 +0100
@@ -16,9 +16,12 @@
     :alt: Documentation Status
 
 .. image:: https://pyup.io/repos/github/metachris/logzero/shield.svg
-     :target: https://pyup.io/repos/github/metachris/logzero/
-     :alt: Updates
+    :target: https://pyup.io/repos/github/metachris/logzero/
+    :alt: Updates
 
+.. image:: https://anaconda.org/conda-forge/logzero/badges/version.svg
+    :target: https://anaconda.org/conda-forge/logzero
+    :alt: Anaconda-Server Badge
 
 Robust and effective logging for Python 2 and 3.
 
@@ -140,6 +143,13 @@
 If you don't have `pip`_ installed, this `Python installation guide`_ can guide
 you through the process.
 
+Alternatively, if you use the `Anaconda distribution 
<https://www.anaconda.com/download/>`_:
+
+.. code-block:: console
+
+    $ conda config --add channels conda-forge
+    $ conda install logzero
+
 You can also install `logzero` from the public `Github repo`_:
 
 .. code-block:: console
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logzero-1.4.0/docs/index.rst 
new/logzero-1.5.0/docs/index.rst
--- old/logzero-1.4.0/docs/index.rst    2018-03-02 18:02:56.000000000 +0100
+++ new/logzero-1.5.0/docs/index.rst    2018-03-07 18:03:39.000000000 +0100
@@ -137,6 +137,8 @@
 
+-----------------------------------------+--------------------------------------------------+
 | Disable logging to a logfile            | `logzero.logfile(None) 
<#i-logzero-logfile>`_    |
 
+-----------------------------------------+--------------------------------------------------+
+| Log to syslog                           | `logzero.syslog(...) 
<#i-logzero-logfile>`_      |
++-----------------------------------------+--------------------------------------------------+
 | Use a custom formatter                  | `logzero.formatter(..) 
<#i-logzero-formatter>`_  |
 
+-----------------------------------------+--------------------------------------------------+
 
@@ -168,6 +170,12 @@
     # Disable logging to a file
     logzero.logfile(None)
 
+    # Log to syslog, using default logzero logger and 'user' syslog facility
+    logzero.syslog()
+
+    # Log to syslog, using default logzero logger and 'local0' syslog facility
+    logzero.syslog(facility=SysLogHandler.LOG_LOCAL0)
+
     # Set a custom formatter
     formatter = logging.Formatter('%(name)s - %(asctime)-15s - %(levelname)s: 
%(message)s');
     logzero.formatter(formatter)
@@ -195,27 +203,27 @@
     logger3.info("info for logger 3")
 
 
-Adding custom handlers (eg. SysLogHandler)
+Adding custom handlers (eg. SocketHandler)
 ------------------------------------------
 
 Since `logzero` uses the standard `Python logger object 
<https://docs.python.org/2/library/logging.html#module-level-functions>`_,
 you can attach any `Python logging handlers 
<https://docs.python.org/2/library/logging.handlers.html>`_ you can imagine!
 
-This is how you add a `SysLogHandler 
<https://docs.python.org/2/library/logging.handlers.html#sysloghandler>`_:
+This is how you add a `SocketHandler 
<https://docs.python.org/2/library/logging.handlers.html#sockethandler>`_:
 
 .. code-block:: python
 
     import logzero
     import logging
-    from logging.handlers import SysLogHandler
+    from logging.handlers import SocketHandler
 
-    # Setup the RotatingFileHandler
-    syslog_handler = SysLogHandler(address=('localhost', 
logging.SYSLOG_UDP_PORT))
-    syslog_handler.setLevel(logging.DEBUG)
-    syslog_handler.setFormatter(logzero.LogFormatter(color=False))
+    # Setup the SocketHandler
+    socket_handler = SocketHandler(address=('localhost', 
logging.DEFAULT_TCP_LOGGING_PORT))
+    socket_handler.setLevel(logging.DEBUG)
+    socket_handler.setFormatter(logzero.LogFormatter(color=False))
 
     # Attach it to the logzero default logger
-    logzero.logger.addHandler(syslog_handler)
+    logzero.logger.addHandler(socket_handler)
 
     # Log messages
     logzero.logger.info("this is a test")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logzero-1.4.0/logzero/__init__.py 
new/logzero-1.5.0/logzero/__init__.py
--- old/logzero-1.4.0/logzero/__init__.py       2018-03-02 18:02:56.000000000 
+0100
+++ new/logzero-1.5.0/logzero/__init__.py       2018-03-07 18:03:39.000000000 
+0100
@@ -39,7 +39,7 @@
 import sys
 import logging
 from logzero.colors import Fore as ForegroundColors
-from logging.handlers import RotatingFileHandler
+from logging.handlers import RotatingFileHandler, SysLogHandler
 
 try:
     import curses  # type: ignore
@@ -48,7 +48,7 @@
 
 __author__ = """Chris Hager"""
 __email__ = '[email protected]'
-__version__ = '1.4.0'
+__version__ = '1.5.0'
 
 # Python 2+3 compatibility settings for logger
 bytes_type = bytes
@@ -409,12 +409,7 @@
     :arg bool disableStderrLogger: Should the default stderr logger be 
disabled. Defaults to False.
     """
     # Step 1: If an internal RotatingFileHandler already exists, remove it
-    for handler in list(logger.handlers):
-        if hasattr(handler, LOGZERO_INTERNAL_LOGGER_ATTR):
-            if isinstance(handler, RotatingFileHandler):
-                logger.removeHandler(handler)
-            elif isinstance(handler, logging.StreamHandler) and 
disableStderrLogger:
-                logger.removeHandler(handler)
+    __remove_internal_loggers(logger, disableStderrLogger)
 
     # Step 2: If wanted, add the RotatingFileHandler now
     if filename:
@@ -431,6 +426,40 @@
         logger.addHandler(rotating_filehandler)
 
 
+def __remove_internal_loggers(logger_to_update, disableStderrLogger=True):
+    """
+    Remove the internal loggers (e.g. stderr logger and file logger) from the 
specific logger
+    :param logger_to_update: the logger to remove internal loggers from
+    :param disableStderrLogger: should the default stderr logger be disabled? 
defaults to True
+    """
+    for handler in list(logger_to_update.handlers):
+        if hasattr(handler, LOGZERO_INTERNAL_LOGGER_ATTR):
+            if isinstance(handler, RotatingFileHandler):
+                logger_to_update.removeHandler(handler)
+            elif isinstance(handler, SysLogHandler):
+                logger_to_update.removeHandler(handler)
+            elif isinstance(handler, logging.StreamHandler) and 
disableStderrLogger:
+                logger_to_update.removeHandler(handler)
+
+
+def syslog(logger_to_update=logger, facility=SysLogHandler.LOG_USER, 
disableStderrLogger=True):
+    """
+    Setup logging to syslog and disable other internal loggers
+    :param logger_to_update: the logger to enable syslog logging for
+    :param facility: syslog facility to log to
+    :param disableStderrLogger: should the default stderr logger be disabled? 
defaults to True
+    :return the new SysLogHandler, which can be modified externally (e.g. for 
custom log level)
+    """
+    # remove internal loggers
+    __remove_internal_loggers(logger_to_update, disableStderrLogger)
+
+    # Setup logzero to only use the syslog handler with the specified facility
+    syslog_handler = SysLogHandler(facility=facility)
+    setattr(syslog_handler, LOGZERO_INTERNAL_LOGGER_ATTR, True)
+    logger_to_update.addHandler(syslog_handler)
+    return syslog_handler
+
+
 def log_function_call(func):
     @functools.wraps(func)
     def wrap(*args, **kwargs):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logzero-1.4.0/logzero.egg-info/PKG-INFO 
new/logzero-1.5.0/logzero.egg-info/PKG-INFO
--- old/logzero-1.4.0/logzero.egg-info/PKG-INFO 2018-03-02 18:06:06.000000000 
+0100
+++ new/logzero-1.5.0/logzero.egg-info/PKG-INFO 2018-03-07 18:04:10.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: logzero
-Version: 1.4.0
+Version: 1.5.0
 Summary: Robust and effective logging for Python 2 and 3
 Home-page: https://github.com/metachris/logzero
 Author: Chris Hager
@@ -25,9 +25,12 @@
             :alt: Documentation Status
         
         .. image:: https://pyup.io/repos/github/metachris/logzero/shield.svg
-             :target: https://pyup.io/repos/github/metachris/logzero/
-             :alt: Updates
+            :target: https://pyup.io/repos/github/metachris/logzero/
+            :alt: Updates
         
+        .. image:: https://anaconda.org/conda-forge/logzero/badges/version.svg
+            :target: https://anaconda.org/conda-forge/logzero
+            :alt: Anaconda-Server Badge
         
         Robust and effective logging for Python 2 and 3.
         
@@ -149,6 +152,13 @@
         If you don't have `pip`_ installed, this `Python installation guide`_ 
can guide
         you through the process.
         
+        Alternatively, if you use the `Anaconda distribution 
<https://www.anaconda.com/download/>`_:
+        
+        .. code-block:: console
+        
+            $ conda config --add channels conda-forge
+            $ conda install logzero
+        
         You can also install `logzero` from the public `Github repo`_:
         
         .. code-block:: console
@@ -184,7 +194,12 @@
         History
         =======
         
-        1.3.1 (2018-03-02)
+        1.5.0 (2018-03-07)
+        ------------------
+        * ``logzero.syslog(..)`` (`PR 83 
<https://github.com/metachris/logzero/pull/84>`_)
+        
+        
+        1.4.0 (2018-03-02)
         ------------------
         * Allow Disabling stderr Output (`PR 83 
<https://github.com/metachris/logzero/pull/83>`_)
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logzero-1.4.0/setup.cfg new/logzero-1.5.0/setup.cfg
--- old/logzero-1.4.0/setup.cfg 2018-03-02 18:06:06.000000000 +0100
+++ new/logzero-1.5.0/setup.cfg 2018-03-07 18:04:10.000000000 +0100
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 1.4.0
+current_version = 1.5.0
 commit = True
 tag = True
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logzero-1.4.0/setup.py new/logzero-1.5.0/setup.py
--- old/logzero-1.4.0/setup.py  2018-03-02 18:02:56.000000000 +0100
+++ new/logzero-1.5.0/setup.py  2018-03-07 18:03:39.000000000 +0100
@@ -13,7 +13,7 @@
 
 setup(
     name='logzero',
-    version='1.4.0',
+    version='1.5.0',
     description="Robust and effective logging for Python 2 and 3",
     long_description=readme + '\n\n' + history,
     author="Chris Hager",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logzero-1.4.0/tests/test_logzero.py 
new/logzero-1.5.0/tests/test_logzero.py
--- old/logzero-1.4.0/tests/test_logzero.py     2018-03-02 18:02:56.000000000 
+0100
+++ new/logzero-1.5.0/tests/test_logzero.py     2018-03-07 18:03:39.000000000 
+0100
@@ -287,3 +287,15 @@
     test_default_logger()
     out, err = capsys.readouterr()
     test_default_logger_output(err)
+
+
+def test_default_logger_syslog_only(capsys):
+    """
+    Run a test logging to ``syslog`` and confirm that no data is written to 
stderr.
+    Note that the output in syslog is not currently being captured or checked.
+    """
+    logzero.reset_default_logger()
+    logzero.syslog()
+    logzero.logger.error('debug')
+    out, err = capsys.readouterr()
+    assert out == '' and err == ''


Reply via email to