NeptuneLoggingHandler
Python package: neptune-scale
A handler that sends the records created by the Python Logger
to Neptune.
Parameters
run
required
A reference to a Run object which should track the logs.
level
int
required
default: logging.NOTSET
Level of the logs to capture:
debug
info
warning
error
critical
By default, all logs that match the logger level are captured.
attribute_path
str
optional
default: None
Path to the StringSeries
attribute that stores the logs. If None
, the logs are stored under runtime/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")