OpenStack library utils
Go to file
Joshua Harlow 346c27b735 Add useful 'time_it' decorator
Create a helpful decorator that can be attached to functions
or methods to show how long they take to run; internally it
uses a stop watch and provided logger to log with (and an
optional logging level to use).

An example:

>>> from oslo_utils import timeutils
>>> import logging
>>> import time
>>> logging.basicConfig(level=logging.DEBUG)
>>> logger = logging.getLogger()
>>>
>>> @timeutils.time_it(logger)
... def a():
...   time.sleep(0.2)
...
>>> a()
DEBUG:root:It took 0.20 seconds to run function '__main__.a'

Change-Id: Ia41d5b6910f7ebe2dd93aaf6ca1defe158f8310c
2015-11-13 10:29:36 -08:00
doc/source Ensure stopwatch __enter__, __exit__ are in docs 2015-10-01 13:00:53 -07:00
oslo_utils Add useful 'time_it' decorator 2015-11-13 10:29:36 -08:00
oslo.utils/locale Imported Translations from Zanata 2015-09-26 06:21:58 +00:00
tools Remove run_cross_tests.sh 2015-05-05 19:39:52 +00:00
.coveragerc Change ignore-errors to ignore_errors 2015-09-21 14:43:41 +00:00
.gitignore Add 'token' to list of fields to be santized by mask_password 2015-09-08 15:45:42 +01:00
.gitreview exported from oslo-incubator by graduate.sh 2014-06-18 20:45:08 -04:00
.mailmap exported from oslo-incubator by graduate.sh 2014-06-18 20:45:08 -04:00
.testr.conf Get the tox tests working 2014-06-18 23:12:10 -04:00
babel.cfg exported from oslo-incubator by graduate.sh 2014-06-18 20:45:08 -04:00
CONTRIBUTING.rst Workflow documentation is now in infra-manual 2014-12-05 03:30:39 +00:00
HACKING.rst exported from oslo-incubator by graduate.sh 2014-06-18 20:45:08 -04:00
LICENSE exported from oslo-incubator by graduate.sh 2014-06-18 20:45:08 -04:00
MANIFEST.in exported from oslo-incubator by graduate.sh 2014-06-18 20:45:08 -04:00
README.rst Switch badges from 'pypip.in' to 'shields.io' 2015-06-11 20:33:03 -07:00
requirements.txt Updated from global requirements 2015-09-17 16:42:28 +00:00
setup.cfg Remove oslo namespace package 2015-07-15 18:20:18 +00:00
setup.py Updated from global requirements 2015-09-17 16:42:28 +00:00
test-requirements.txt Updated from global requirements 2015-08-27 04:18:22 +00:00
tox.ini flake8 - remove unused rules 2015-08-08 11:41:38 +00:00

oslo.utils

Latest Version

Downloads

The oslo.utils library provides support for common utility type functions, such as encoding, exception handling, string manipulation, and time handling.