Quick Integration for Python Logs
1. Installation with pip
Shipbook is available through: PyPI
pip install shipbook
2. Initializing Shipbook into your code
To initialize Shipbook, add the following where your app starts:
import shipbook
shipbook.start(app_id="YOUR_APP_ID", app_key="YOUR_APP_KEY")
3. Adding logs
Shipbook plugs into Python's standard logging module, so there is no new logging API. Create a logger in each module:
import logging
log = logging.getLogger(__name__)
The usage of the log:
log.error("the log message") # Error log
log.warning("the log message") # Warning log
log.info("the log message") # Info log
log.debug("the log message") # Debug log
Python drops info and debug logs unless the logger's level allows them. To send info logs too, pass capture_level to start:
shipbook.start(app_id="YOUR_APP_ID", app_key="YOUR_APP_KEY", capture_level=logging.INFO)