Skip to main content
# Metadata for Functions
Python decorator function to track metadata on function calls

# Example
```python
@meta_func(ignore_errors=True)
def self_mult(n):
sleep(0.2)
return n*n

print(self_mult(10)) # => 100
print(self_mult.log_info()) # => {'time_started': 1422042033.971449, 'warnings': None, 'args': (10,), 'error_info': None, 'time_ended': 1422042034.171857, 'time_elapsed': 0.200408, 'return_value': 100, 'kwargs': None}

print(self_mult(15)) # => 225
print(self_mult.log_info()) # => {'time_started': 1422042034.172171, 'warnings': None, 'args': (15,), 'error_info': None, 'time_ended': 1422042034.373299, 'time_elapsed': 0.201128, 'return_value': 225, 'kwargs': None}

print(self_mult("foo")) # => None
print(self_mult.log_info()) # => {'time_started': 1422042034.373651, 'warnings': None, 'args': ('foo',), 'error_info': (<type 'exceptions.TypeError'>, TypeError("can't multiply sequence by non-int of type 'str'",), <traceback object at 0x10fcea098>), 'time_ended': 1422042034.574758, 'time_elapsed': 0.201107, 'return_value': None, 'kwargs': None}
```

# Usage
Decorate a function with `@meta_func()` passing the optional keyword argument ignore_errors = True/False. ignore_errors tells `@meta_func` whether or not to raise any exception your decorated function raises or to solely log to the error_info attribute.

# Compatibility
Tested compatible with Py2.7 and Py3, but this code is provided as is with no warranty or guarantee, implied or explicit.

# More Information
Please see my blog post here: http://garrens.com/blog/2015/01/23/metadata-for-functions-python-decorator/

Release files for meta_func 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meta_func 0.1.3
File Size Uploaded
meta_func-0.1.3.tar.gz 2.4 kB Details

Release files / meta_func-0.1.3.tar.gz

Download URL meta_func-0.1.3.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5a8df9e0fc3797ab8942d67912163d2a410310e88029c10b0370c45a8c47cff4
BLAKE2b-256 checksum
How to use checksums
9a2c6523741535354cf8e01252007bf854a38b49f0fd1a2230bd80b58f946c1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page