Backend: Error Monitoring
Go
Java
JS
Python
Ruby
Backend: Logging
Go
JS
Python
Ruby
Java
Hosting Providers
Backend: Tracing
Go
Node.js
Python
Native OpenTelemetry
Fullstack Frameworks
Overview
Self Host & Local Dev
Menu
Python Logging Quick Start
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
# or with pip
pip install highlight-io
3
Initialize the Highlight SDK.
Setup the SDK with instrument_logging
enabled.
import highlight_io
H = highlight_io.H("<YOUR_PROJECT_ID>", instrument_logging=True)
4
Call the built-in Python logging library.
Logs are reported automatically from the builtin logging methods (as long as instrument_logging=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.