Skip to main content
App version: 3.4.10

NeptuneLoggingHandler

Python package: neptune-scale

A handler that sends the records created by the Python Logger to Neptune.

Parameters

NameTypeDefaultDescription
runRun-A reference to a Run object which should track the logs.
levelintlogging.NOTSETLevel of the logs to capture:
  1. debug
  2. info
  3. warning
  4. error
  5. critical
By default, all logs that match the logger level are captured.
atribute_pathstr, optionalNonePath to the StringSeries attribute that stores the logs. If None, the logs are stored under system/logs.

Example

from neptune_scale import Run
from neptune_scale import NeptuneLoggingHandler

import logging


run = Run(
api_token="eyJhcGlfYWRkcmVz...In0=",
project="team-alpha/project-x",
)

# Create a logger
logger = logging.getLogger("my_experiment")

# 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")