Metadata-Version: 1.0
Name: diagnostics
Version: 0.2.1
Summary: Alternative to Python's module `cgitb` with template inspired by Nette and Django
Home-page: https://github.com/miso-belica/diagnostics
Author: Michal Belica
Author-email: miso.belica@gmail.com
License: Copyright 2013 Michal Belica

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Description: ===========
        Diagnostics
        ===========
        .. image:: https://api.travis-ci.org/miso-belica/diagnostics.png?branch=master
           :target: https://travis-ci.org/miso-belica/diagnostics
        
        Module for logging of `detailed traceback
        <http://miso-belica.github.io/diagnostics/log-example.html>`_ as HTML page.
        Unexpected exceptions are catched and logged for further audit. Exceptions
        in diagnostic's exception handler are properly handled and logged
        (but formatted only as standard Python traceback). Usage is simple as code below.
        
        .. code-block:: python
        
            from diagnostics import exception_hook
        
            if __name__ == '__main__':
                # you have to create "log/" directory next to file that is your main module
                exception_hook.enable()
        
        .. code-block:: python
        
            from diagnostics import exception_hook
            from diagnostics.storages import FileStorage
        
            if __name__ == '__main__':
                # or simply set your own storage
                directory_path = "/path/to/your/log/directory/with/html/tracebacks"
                exception_hook.enable(storage=FileStorage(directory_path))
        
        .. code-block:: python
        
            from diagnostics import exception_hook
        
            if __name__ == '__main__':
                with exception_hook:
                    try_do_risky_job(...)
        
        There is even support for logging in diagnostics. Class
        ``diagnostics.logging.FileHandler`` creates files with detailed traceback
        and log messages are appended to the file *info.log* in directory with
        logged tracebacks.
        
        .. code-block:: python
        
            import logging
        
            from diagnostics import exception_hook
            from diagnostics.logging import FileHandler
        
            if __name__ == '__main__':
                file_path = "/path/to/log/directory/with/html/tracebacks/info.log"
                log_handler = FileHandler(file_path)
                exception_hook.enable_for_logger(logging.getLogger(), handler=log_handler)
        
                try:
                    try_do_risky_job(...)
                except:
                    logging.exception("Risky job failed")
        
        .. code-block:: python
        
            import logging
        
            from diagnostics import exception_hook
            from diagnostics.logging import FileHandler
        
            if __name__ == '__main__':
                file_path = "/path/to/log/directory/with/html/tracebacks/info.log"
                log_handler = FileHandler(file_path)
                exception_hook.enable_for_logger("example_logger", handler=log_handler)
        
                try:
                    try_do_risky_job(...)
                except:
                    logger = logging.getLogger("example_logger")
                    logger.error("Error occured", exc_info=True)
        
        Installation
        ------------
        From PyPI
        ::
        
            pip install diagnostics
        
        or from git repo
        ::
        
            pip install git+git://github.com/miso-belica/diagnostics.git
        
        Tests
        -----
        Run tests via
        
        .. code-block:: bash
        
            $ nosetests-2.6 && nosetests-3.2 && nosetests-2.7 && nosetests-3.3
        
        
        .. :changelog:
        
        Changelog for diagnostics module
        ================================
        
        0.2.1 (2013-10-04)
        ------------------
        - *FEATURE:* Removed empty trailing lines from context code.
        - *BUG FIX:* Removed duplicated global variables from list of local variables.
        - *BUG FIX:* Don't show types/modules/functions in list of local variables.
        
        0.2.0 (2013-06-22)
        ------------------
        - *BUG FIX:* Removed class types, modules and other crap from
          list of global variables.
        - *BUG FIX:* Function/method variables are ordered according
          to function/method signature.
        - *FEATURE:* The same exceptions are stored only once
          (according to their hash).
        - *BUG FIX:* Recover when converting object to unicode raises
          exception (e.g. BeautifulSoup).
        - *BUG FIX:* Format code context even if code is in binary form
          (e.g. lxml).
        - *BUG FIX:* Use `repr` function when instance can't be de/en-coded
          to the unicode/bytes.
        - *BUG FIX:* Tracebacks with the same type of exception and timestamp
          are stored to different files.
        - *FEATURE:* Added support for with statement.
        - *FEATURE:* Added logging support.
        
        0.1.0 (2013-02-13)
        ------------------
        - First public release.
        
Keywords: debug,cgitb,traceback
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Utilities
Classifier: Topic :: Software Development :: Bug Tracking
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: Implementation :: CPython
