class_docstr: Handler that sends the log records created by the logger to Neptune
  
  Args:
      run (Run): An existing run reference (as returned by `neptune.init_run`)
          Logger will send messages as a `StringSeries` field on this run.
      level (int, optional): Log level of the handler. Defaults to `logging.NOTSET`,
          which logs everything that matches logger's level.
      path (str, optional): Path to the `StringSeries` field used for logging. Default to `None`.
          If `None`, `'monitoring/python_logger'` is used.
  
  Examples:
      >>> import logging
      >>> import neptune
      >>> from neptune.integrations.python_logger import NeptuneHandler
  
      >>> logger = logging.getLogger("root_experiment")
      >>> logger.setLevel(logging.DEBUG)
  
      >>> run = neptune.init_run(project="neptune/sandbox")
      >>> npt_handler = NeptuneHandler(run=run)
      >>> logger.addHandler(npt_handler)
  
      >>> logger.debug("Starting data preparation")
      ...
      >>> logger.debug("Data preparation done")
class_docstr_tok: ["Handler","that","sends","the","log","records","created","by","the","logger","to","Neptune","Args",":","run","(","Run",")",":","An","existing","run","reference","(","as","returned","by","`","neptune.init_run","`",")","Logger","will","send","messages","as","a","`","StringSeries","`","field","on","this","run",".","level","(","int",",","optional",")",":","Log","level","of","the","handler",".","Defaults","to","`","logging.NOTSET","`",",","which","logs","everything","that","matches","logger","'s","level",".","path","(","str",",","optional",")",":","Path","to","the","`","StringSeries","`","field","used","for","logging",".","Default","to","`","None","`",".","If","`","None","`",",","`","'monitoring\/python_logger","'","`","is","used",".","Examples",":",">",">",">","import","logging",">",">",">","import","neptune",">",">",">","from","neptune.integrations.python_logger","import","NeptuneHandler",">",">",">","logger","=","logging.getLogger","(","``","root_experiment","''",")",">",">",">","logger.setLevel","(","logging.DEBUG",")",">",">",">","run","=","neptune.init_run","(","project=","''","neptune\/sandbox","''",")",">",">",">","npt_handler","=","NeptuneHandler","(","run=run",")",">",">",">","logger.addHandler","(","npt_handler",")",">",">",">","logger.debug","(","``","Starting","data","preparation","''",")","...",">",">",">","logger.debug","(","``","Data","preparation","done","''",")"]
code: def emit(self, record: logging.LogRecord) -> None:
      if not hasattr(self._thread_local, "inside_write"):
          self._thread_local.inside_write = False
  
      if (
          self._run.get_state() == ContainerState.STARTED.value
          and not self._thread_local.inside_write
      ):
          try:
              self._thread_local.inside_write = True
              message = self.format(record)
              self._logger.log(message)
          finally:
              self._thread_local.inside_write = False
  
file_path: neptune-client/src/neptune/integrations/python_logger.py
imports: import logging
  import threading
  from neptune import Run
  from neptune.internal.state import ContainerState
  from neptune.internal.utils import verify_type
  from neptune.logging import Logger
  from neptune.version import version
label_desc: Use image node_id 2 for calling the NeptuneHandler obj's underlying member method code with example usage: obj.emit(record) without return types