Skip to main content
Prerequisite You should have Python v3.10 or higher installed.

Install SDK

We use uv as a package manager. You can install the sdk via:
uv add navigator-sdk
Alternatively, if you are using poetry or pip, you can install it via:
poetry add navigator-sdk

Setup logger

There are two ways you can initialize the logger
  1. By setting env variables
  2. By initializing at runtime

1. By setting up .env variables

You can set the following environment variables in order to automatically setup logger.
ENVIRONMENT         = Environment
NAVIGATOR_API_URL   = https://api.usenavigator.co
NAIGATOR_API_KEY    = pk_live_abc..xyz
NAVIGATOR_DOMAIN    = Domain name (i.e. Data Infrastructure)
NAVIGATOR_SERVICE   = Service name (i.e. Airflow)
NAVIGATOR_TRACE_ID  = Default trace ID for correlating logs
And then initialize by:
from navigator_sdk import setup_logger

logger = setup_logger()

2. By setting up at runtime

You can also pass the same variables at runtime to setup logger.
python
from navigator_sdk import setup_logger

logger = setup_logger(
    environment='production',
    api_url='https://api.usenavigator.co',
    api_key='pk_live_abc..xyz',
    domain='domain',
    service='service',
    trace_id='trace_id'
)

Send logs

By default, the logging via sdk is best-effort and synchronous.
Your logger is now ready to send logs.
python
logger.info("Hello world")
Go to app.usenavigator.co to start using Navigator.

Optional Configuration

By default, the logging via sdk is synchronous and best-effort with retries. You can configure retries and base delay.
NAVIGATOR_MAX_RETRIES       = Number of retries after initial attempt (default: 3)
NAVIGATOR_RETRY_BASE_DELAY  = Base retry delay in seconds (default: 1.0)
NAVIGATOR_RETRY_MAX_DELAY   = Max retry delay in seconds (default: 60.0)