Backend: Error Monitoring
Go
JS
Python
Backend: Logging
Fullstack Frameworks
Next.JS
Self Host & Local Dev
Menu
Python App
Learn how to set up highlight.io Python log ingestion without a logging library.
1
Set up your frontend highlight.io integration.
First, make sure you've followed the frontend getting started guide.
2
Install the highlight-io python package.
Download the package from pypi and save it to your requirements. If you use a zip or s3 file upload to publish your function, you will want to make sure highlight-io
is part of the build.
poetry add highlight-io[Flask]
# or with pip
pip install highlight-io[Flask]
3
Initialize the Highlight SDK.
Setup the SDK with record_logs
enabled.
import highlight_io
H = highlight_io.H("YOUR_PROJECT_ID", record_logs=True)
4
Call the built-in Python logging library.
Logs are reported automatically from the builtin logging methods (as long as record_logs=True
is provided to the highlight_io.H
constructor). Visit the highlight logs portal and check that backend logs are coming in. Arguments passed as a dictionary as the second parameter will be interpreted as structured key-value pairs that logs can be easily searched by.
import logging
def main():
logging.info('hello, world!')
logging.warn('whoa there', {'key': 'value'})
5
Verify your backend logs are being recorded.
Visit the highlight logs portal and check that backend logs are coming in.