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

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.1.0.tar.gz (7.9 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.1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tracethat-1.1.0.tar.gz
Algorithm Hash digest
SHA256 56c7d94714f25a6ea7e6e45d3f42a86a9156f52eedac3e193636d5bc61e8a971
MD5 45593091db6c9ca99749e5600f7856b7
BLAKE2b-256 8d06c43621ca2266655411be4de18520b9989bfa2eb58ffbee7a533b268a8ee8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tracethat-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 716a387a47dfbc13cdab3424f764d56eff5dc667e2285e83ec361a36f9591803
MD5 6f5c7ce79e92f0aa1e9933738974d680
BLAKE2b-256 cb95fd4956b54f80635c187dacdc2f42738113236f3d7dabb3f580a848a8bf1b

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