Skip to main content

tracethat.dev reporter for Python

Project description

Installation

pip install tracethat

Example

from tracethat import tracethat, register_token

register_token('your_token')

@tracethat
async def hello(name: str) -> str:
    await asyncio.sleep(1)
    return f'Hello, {name}!'

async def main():
    await hello(name='John')

if __name__ == '__main__':
    asyncio.run(main())

Reference

tracethat

tracethat is a decorator that wraps a function and logs its execution. It takes a function as an argument and returns a wrapped function. It accepts both sync and async functions.

@tracethat
def hello(name: str) -> str:
    return f'Hello, {name}!'

tracethat.log

tracethat.log is a function that logs a message. It accepts a string as an argument and an optional payload.

tracethat.log('hello', {'name': 'John'})

register_token

You will need to register your token before using the reporter. You can do this by calling the register_token function and passing your token as an argument.

from tracethat import register_token

register_token('your_token')

or by setting the TT_TOKEN environment variable.

TT_TOKEN=your_token python3 main.py

Testing

Unit tests

python -m unittest discover -p '*_test.py'

Deployment

To deploy the package to PyPI, run the following command:

python3 -m build
python3 -m twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tracethat-1.0.4.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tracethat-1.0.4-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file tracethat-1.0.4.tar.gz.

File metadata

  • Download URL: tracethat-1.0.4.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for tracethat-1.0.4.tar.gz
Algorithm Hash digest
SHA256 cce126d82fe65c2da865f46a9028b54e0a78a1e102cd1d6cad2830c3e30da194
MD5 e73f011870a0799963d3333239ad6c69
BLAKE2b-256 acabaf0bbcbac610c5917fd6d3a6e00ba7ba332674de0b7c6260460e4e065bad

See more details on using hashes here.

File details

Details for the file tracethat-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: tracethat-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for tracethat-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4957689dcc9146d1fa63d1ad39357889049bbf825e791d8da26a47652598d02d
MD5 9e895840e954809340025ab08ecb54d1
BLAKE2b-256 c766306996212534f18557948759fcbeefe9480c13a2d77afcde022c4736a124

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page