NeptuneLoggingHandler
Python package: neptune-scale
A handler that sends the records created by the Python Logger to Neptune.
Parameters
| Name | Type | Default | Description | 
|---|---|---|---|
| run | Run | - | A reference to a Run object which should track the logs. | 
| level | int | logging.NOTSET | Level of the logs to capture: 
 | 
| attribute_path | str, optional | None | Path to the StringSeriesattribute that stores the logs. IfNone, the logs are stored underruntime/logs. | 
Example
from neptune_scale import Run
from neptune_scale import NeptuneLoggingHandler
import logging
# Create a logger
logger = logging.getLogger("my_experiment")
logger.setLevel(logging.INFO)
if __name__ == "__main__":
    run = Run(
        api_token="eyJhcGlfYWRkcmVz...In0=",  
        project="team-alpha/project-x",
    )
   
    # Create a NeptuneLoggingHandler object and add it to the logger
    npt_handler = NeptuneLoggingHandler(run=run)
    logger.addHandler(npt_handler)
    # Log messages
    logger.info("Starting data preparation")