tasklogger


Nametasklogger JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/scottgigante/tasklogger
Summarytasklogger
upload_time2022-07-05 14:22:31
maintainer
docs_urlNone
authorScott Gigante, Yale University
requires_python>=3.6
licenseGNU General Public License Version 2
keywords big-data tool-development programming
VCS
bugtrack_url
requirements future
Travis-CI
coveralls test coverage No coveralls.
            ==========
tasklogger
==========

.. image:: https://img.shields.io/pypi/v/tasklogger.svg
    :target: https://pypi.org/project/tasklogger/
    :alt: Latest PyPi version
.. image:: https://anaconda.org/conda-forge/tasklogger/badges/version.svg
    :target: https://anaconda.org/conda-forge/tasklogger/
    :alt: Latest Conda version
.. image:: https://api.travis-ci.com/scottgigante/tasklogger.svg?branch=master
    :target: https://github.com/scottgigante/tasklogger/actions
    :alt: GitHub Actions Build
.. image:: https://ci.appveyor.com/api/projects/status/qi79tqay73uslr0i/branch/master?svg=true
    :target: https://ci.appveyor.com/project/scottgigante/tasklogger
    :alt: Appveyor Build
.. image:: https://coveralls.io/repos/github/scottgigante/tasklogger/badge.svg?branch=master
    :target: https://coveralls.io/github/scottgigante/tasklogger?branch=master
    :alt: Coverage Status
.. image:: https://img.shields.io/twitter/follow/scottgigante.svg?style=social&label=Follow
    :target: https://twitter.com/scottgigante
    :alt: Twitter
.. image:: https://img.shields.io/github/stars/scottgigante/tasklogger.svg?style=social&label=Stars
    :target: https://github.com/scottgigante/tasklogger/
    :alt: GitHub stars
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Code style: black
.. image:: https://img.shields.io/badge/style%20guide-openstack-eb1a32.svg
    :target: https://docs.openstack.org/hacking/latest/user/hacking.html#styleguide
    :alt: Style Guide: OpenStack
.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
    :target: https://github.com/pre-commit/pre-commit
    :alt: pre-commit

An extension to the core python logging library for logging the beginning and completion of tasks and subtasks.

Installation
------------

tasklogger is available on `pip`. Install by running the following in a terminal::

    pip install --user tasklogger

Alternatively, tasklogger can be installed using `Conda <https://conda.io/docs/>`_ (most easily obtained via the `Miniconda Python distribution <https://conda.io/miniconda.html>`_)::

    conda install -c conda-forge tasklogger

Usage examples
--------------

Receive timed updates mid-computation using ``tasklogger.log_start`` and ``tasklogger.log_complete``::

    >>> import tasklogger
    >>> import time
    >>> tasklogger.log_start("Supertask")
    Calculating Supertask...
    >>> time.sleep(1)
    >>> tasklogger.log_start("Subtask")
      Calculating Subtask...
    >>> time.sleep(1)
    >>> tasklogger.log_complete("Subtask")
      Calculated Subtask in 1.01 seconds.
    >>> time.sleep(1)
    >>> tasklogger.log_complete("Supertask")
    Calculated Supertask in 3.02 seconds.

Simplify logging syntax with ``tasklogger.log_task``::

    >>> import tasklogger
    >>> import time
    >>> with tasklogger.log_task("Supertask"):
    ...     time.sleep(1)
    ...     with tasklogger.log_task("Subtask"):
    ...        time.sleep(1)
    ...     time.sleep(1)
    Calculating Supertask...
      Calculating Subtask...
      Calculated Subtask in 1.01 seconds.
    Calculated Supertask in 3.02 seconds.

Log wall time, CPU time, or any other counter function with the class API::

    >>> import tasklogger
    >>> import time
    >>> logger = tasklogger.TaskLogger(name='cpu_logger', timer='cpu', min_runtime=0)
    >>> with logger.log_task("Supertask"):
    ...     time.sleep(1)
    ...     with logger.log_task("Subtask"):
    ...        _ = [[(i,j) for j in range(i)] for i in range(1000)]
    ...     time.sleep(1)
    Calculating Supertask...
      Calculating Subtask...
      Calculated Subtask in 0.09 seconds.
    Calculated Supertask in 0.09 seconds.
    >>> logger = tasklogger.TaskLogger(name='nano_logger', timer=time.monotonic_ns)
    >>> with logger.log_task("Supertask"):
    ...     time.sleep(1)
    ...     with logger.log_task("Subtask"):
    ...        time.sleep(1)
    ...     time.sleep(1)
    Calculating Supertask...
      Calculating Subtask...
      Calculated Subtask in 1001083511.00 seconds.
    Calculated Supertask in 3003702161.00 seconds.

Use ``tasklogger`` for all your logging needs::

    >>> tasklogger.log_info("Log some stuff that doesn't need timing")
    Log some stuff that doesn't need timing
    >>> tasklogger.log_debug("Log some stuff that normally isn't needed")
    >>> tasklogger.set_level(2)
    Set TaskLogger logging to DEBUG
    >>> tasklogger.log_debug("Log some stuff that normally isn't needed")
    Log some stuff that normally isn't needed

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/scottgigante/tasklogger",
    "name": "tasklogger",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "big-data,tool-development,programming",
    "author": "Scott Gigante, Yale University",
    "author_email": "scott.gigante@yale.edu",
    "download_url": "https://files.pythonhosted.org/packages/08/49/284c99df2cbe3a0d6df5a3d5010dfc5d425bb332f5b04739af469703f9f5/tasklogger-1.2.0.tar.gz",
    "platform": null,
    "description": "==========\ntasklogger\n==========\n\n.. image:: https://img.shields.io/pypi/v/tasklogger.svg\n    :target: https://pypi.org/project/tasklogger/\n    :alt: Latest PyPi version\n.. image:: https://anaconda.org/conda-forge/tasklogger/badges/version.svg\n    :target: https://anaconda.org/conda-forge/tasklogger/\n    :alt: Latest Conda version\n.. image:: https://api.travis-ci.com/scottgigante/tasklogger.svg?branch=master\n    :target: https://github.com/scottgigante/tasklogger/actions\n    :alt: GitHub Actions Build\n.. image:: https://ci.appveyor.com/api/projects/status/qi79tqay73uslr0i/branch/master?svg=true\n    :target: https://ci.appveyor.com/project/scottgigante/tasklogger\n    :alt: Appveyor Build\n.. image:: https://coveralls.io/repos/github/scottgigante/tasklogger/badge.svg?branch=master\n    :target: https://coveralls.io/github/scottgigante/tasklogger?branch=master\n    :alt: Coverage Status\n.. image:: https://img.shields.io/twitter/follow/scottgigante.svg?style=social&label=Follow\n    :target: https://twitter.com/scottgigante\n    :alt: Twitter\n.. image:: https://img.shields.io/github/stars/scottgigante/tasklogger.svg?style=social&label=Stars\n    :target: https://github.com/scottgigante/tasklogger/\n    :alt: GitHub stars\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code style: black\n.. image:: https://img.shields.io/badge/style%20guide-openstack-eb1a32.svg\n    :target: https://docs.openstack.org/hacking/latest/user/hacking.html#styleguide\n    :alt: Style Guide: OpenStack\n.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white\n    :target: https://github.com/pre-commit/pre-commit\n    :alt: pre-commit\n\nAn extension to the core python logging library for logging the beginning and completion of tasks and subtasks.\n\nInstallation\n------------\n\ntasklogger is available on `pip`. Install by running the following in a terminal::\n\n    pip install --user tasklogger\n\nAlternatively, tasklogger can be installed using `Conda <https://conda.io/docs/>`_ (most easily obtained via the `Miniconda Python distribution <https://conda.io/miniconda.html>`_)::\n\n    conda install -c conda-forge tasklogger\n\nUsage examples\n--------------\n\nReceive timed updates mid-computation using ``tasklogger.log_start`` and ``tasklogger.log_complete``::\n\n    >>> import tasklogger\n    >>> import time\n    >>> tasklogger.log_start(\"Supertask\")\n    Calculating Supertask...\n    >>> time.sleep(1)\n    >>> tasklogger.log_start(\"Subtask\")\n      Calculating Subtask...\n    >>> time.sleep(1)\n    >>> tasklogger.log_complete(\"Subtask\")\n      Calculated Subtask in 1.01 seconds.\n    >>> time.sleep(1)\n    >>> tasklogger.log_complete(\"Supertask\")\n    Calculated Supertask in 3.02 seconds.\n\nSimplify logging syntax with ``tasklogger.log_task``::\n\n    >>> import tasklogger\n    >>> import time\n    >>> with tasklogger.log_task(\"Supertask\"):\n    ...     time.sleep(1)\n    ...     with tasklogger.log_task(\"Subtask\"):\n    ...        time.sleep(1)\n    ...     time.sleep(1)\n    Calculating Supertask...\n      Calculating Subtask...\n      Calculated Subtask in 1.01 seconds.\n    Calculated Supertask in 3.02 seconds.\n\nLog wall time, CPU time, or any other counter function with the class API::\n\n    >>> import tasklogger\n    >>> import time\n    >>> logger = tasklogger.TaskLogger(name='cpu_logger', timer='cpu', min_runtime=0)\n    >>> with logger.log_task(\"Supertask\"):\n    ...     time.sleep(1)\n    ...     with logger.log_task(\"Subtask\"):\n    ...        _ = [[(i,j) for j in range(i)] for i in range(1000)]\n    ...     time.sleep(1)\n    Calculating Supertask...\n      Calculating Subtask...\n      Calculated Subtask in 0.09 seconds.\n    Calculated Supertask in 0.09 seconds.\n    >>> logger = tasklogger.TaskLogger(name='nano_logger', timer=time.monotonic_ns)\n    >>> with logger.log_task(\"Supertask\"):\n    ...     time.sleep(1)\n    ...     with logger.log_task(\"Subtask\"):\n    ...        time.sleep(1)\n    ...     time.sleep(1)\n    Calculating Supertask...\n      Calculating Subtask...\n      Calculated Subtask in 1001083511.00 seconds.\n    Calculated Supertask in 3003702161.00 seconds.\n\nUse ``tasklogger`` for all your logging needs::\n\n    >>> tasklogger.log_info(\"Log some stuff that doesn't need timing\")\n    Log some stuff that doesn't need timing\n    >>> tasklogger.log_debug(\"Log some stuff that normally isn't needed\")\n    >>> tasklogger.set_level(2)\n    Set TaskLogger logging to DEBUG\n    >>> tasklogger.log_debug(\"Log some stuff that normally isn't needed\")\n    Log some stuff that normally isn't needed\n",
    "bugtrack_url": null,
    "license": "GNU General Public License Version 2",
    "summary": "tasklogger",
    "version": "1.2.0",
    "split_keywords": [
        "big-data",
        "tool-development",
        "programming"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "162bc1f3fcd983b7bc9b3f7c2e2fe87c",
                "sha256": "b320fcabbb6bbd88e63c65cd994d75038c2cde45b58eb28941c3848710855524"
            },
            "downloads": -1,
            "filename": "tasklogger-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "162bc1f3fcd983b7bc9b3f7c2e2fe87c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 14626,
            "upload_time": "2022-07-05T14:22:29",
            "upload_time_iso_8601": "2022-07-05T14:22:29.849707Z",
            "url": "https://files.pythonhosted.org/packages/d6/f5/24855d6d8862ad03ae4dbb8f3ec06baf930a276c92af603b3d9bf32600d0/tasklogger-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "58942e1608a1b42c86b79039c9814ade",
                "sha256": "b0a390dbe1d4c6f7465e58ee457b5bb381657b5ede3a85bcf45199cb56ac01a4"
            },
            "downloads": -1,
            "filename": "tasklogger-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "58942e1608a1b42c86b79039c9814ade",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 15965,
            "upload_time": "2022-07-05T14:22:31",
            "upload_time_iso_8601": "2022-07-05T14:22:31.407306Z",
            "url": "https://files.pythonhosted.org/packages/08/49/284c99df2cbe3a0d6df5a3d5010dfc5d425bb332f5b04739af469703f9f5/tasklogger-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-07-05 14:22:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "scottgigante",
    "github_project": "tasklogger",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "appveyor": true,
    "requirements": [
        {
            "name": "future",
            "specs": []
        }
    ],
    "lcname": "tasklogger"
}
        
Elapsed time: 0.03641s