{
    "content": [
        {
            "type": "text",
            "text": "# logging (pydoc)\n\n**Summary:** logging\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **MODULE REFERENCE** (8 lines)\n- **DESCRIPTION** (7 lines)\n- **PACKAGE CONTENTS** (3 lines)\n- **CLASSES** (13 lines) — 10 subsections\n  - class BufferingFormatter (28 lines)\n  - class FileHandler (130 lines)\n  - class Filter (35 lines)\n  - class Formatter (135 lines)\n  - class Handler (121 lines)\n  - class LogRecord (35 lines)\n  - class Logger (187 lines)\n  - class LoggerAdapter (81 lines)\n  - class NullHandler (118 lines)\n  - class StreamHandler (136 lines)\n- **FUNCTIONS** (1 lines) — 21 subsections\n  - addLevelName (4 lines)\n  - basicConfig (66 lines)\n  - captureWarnings (4 lines)\n  - critical (4 lines)\n  - debug (4 lines)\n  - disable (2 lines)\n  - error (4 lines)\n  - exception (4 lines)\n  - fatal (2 lines)\n  - getLevelName (16 lines)\n  - getLogRecordFactory (2 lines)\n  - getLogger (4 lines)\n  - getLoggerClass (2 lines)\n  - info (4 lines)\n  - log (4 lines)\n  - makeLogRecord (5 lines)\n  - setLogRecordFactory (5 lines)\n  - setLoggerClass (4 lines)\n  - shutdown (5 lines)\n  - warn (1 lines)\n  - warning (4 lines)\n- **DATA** (14 lines)\n- **VERSION** (2 lines)\n- **DATE** (2 lines)\n- **AUTHOR** (2 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\nlogging\n\n### MODULE REFERENCE\n\nhttps://docs.python.org/3.10/library/logging.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n\n### DESCRIPTION\n\nLogging package for Python. Based on PEP 282 and comments thereto in\ncomp.lang.python.\n\nCopyright (C) 2001-2019 Vinay Sajip. All Rights Reserved.\n\nTo use, simply 'import logging' and log away!\n\n### PACKAGE CONTENTS\n\nconfig\nhandlers\n\n### CLASSES\n\nbuiltins.object\nBufferingFormatter\nFilter\nFormatter\nLogRecord\nLoggerAdapter\nFilterer(builtins.object)\nHandler\nNullHandler\nStreamHandler\nFileHandler\nLogger\n\n#### class BufferingFormatter\n\n|  BufferingFormatter(linefmt=None)\n|\n|  A formatter suitable for formatting a number of records.\n|\n|  Methods defined here:\n|\n|  init(self, linefmt=None)\n|      Optionally specify a formatter which will be used to format each\n|      individual record.\n|\n|  format(self, records)\n|      Format the specified records and return the result as a string.\n|\n|  formatFooter(self, records)\n|      Return the footer string for the specified records.\n|\n|  formatHeader(self, records)\n|      Return the header string for the specified records.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n#### class FileHandler\n\n|  FileHandler(filename, mode='a', encoding=None, delay=False, errors=None)\n|\n|  A handler class which writes formatted logging records to disk files.\n|\n|  Method resolution order:\n|      FileHandler\n|      StreamHandler\n|      Handler\n|      Filterer\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, filename, mode='a', encoding=None, delay=False, errors=None)\n|      Open the specified file and use it as the stream for logging.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  close(self)\n|      Closes the stream.\n|\n|  emit(self, record)\n|      Emit a record.\n|\n|      If the stream was not opened because 'delay' was specified in the\n|      constructor, open it before calling the superclass's emit.\n|\n|      If stream is not open, current mode is 'w' and `closed=True`, record\n|      will not be emitted (see Issue #42378).\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from StreamHandler:\n|\n|  flush(self)\n|      Flushes the stream.\n|\n|  setStream(self, stream)\n|      Sets the StreamHandler's stream to the specified value,\n|      if it is different.\n|\n|      Returns the old stream, if the stream was changed, or None\n|      if it wasn't.\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes inherited from StreamHandler:\n|\n|  terminator = '\\n'\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from Handler:\n|\n|  acquire(self)\n|      Acquire the I/O thread lock.\n|\n|  createLock(self)\n|      Acquire a thread lock for serializing access to the underlying I/O.\n|\n|  format(self, record)\n|      Format the specified record.\n|\n|      If a formatter is set, use it. Otherwise, use the default formatter\n|      for the module.\n|\n|  getname(self)\n|\n|  handle(self, record)\n|      Conditionally emit the specified logging record.\n|\n|      Emission depends on filters which may have been added to the handler.\n|      Wrap the actual emission of the record with acquisition/release of\n|      the I/O thread lock. Returns whether the filter passed the record for\n|      emission.\n|\n|  handleError(self, record)\n|      Handle errors which occur during an emit() call.\n|\n|      This method should be called from handlers when an exception is\n|      encountered during an emit() call. If raiseExceptions is false,\n|      exceptions get silently ignored. This is what is mostly wanted\n|      for a logging system - most users will not care about errors in\n|      the logging system, they are more interested in application errors.\n|      You could, however, replace this with a custom handler if you wish.\n|      The record which was being processed is passed in to this method.\n|\n|  release(self)\n|      Release the I/O thread lock.\n|\n|  setFormatter(self, fmt)\n|      Set the formatter for this handler.\n|\n|  setLevel(self, level)\n|      Set the logging level of this handler.  level must be an int or a str.\n|\n|  setname(self, name)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from Handler:\n|\n|  name\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from Filterer:\n|\n|  addFilter(self, filter)\n|      Add the specified filter to this handler.\n|\n|  filter(self, record)\n|      Determine if a record is loggable by consulting all the filters.\n|\n|      The default is to allow the record to be logged; any filter can veto\n|      this and the record is then dropped. Returns a zero value if a record\n|      is to be dropped, else non-zero.\n|\n|      .. versionchanged:: 3.2\n|\n|         Allow filters to be just callables.\n|\n|  removeFilter(self, filter)\n|      Remove the specified filter from this handler.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from Filterer:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n#### class Filter\n\n|  Filter(name='')\n|\n|  Filter instances are used to perform arbitrary filtering of LogRecords.\n|\n|  Loggers and Handlers can optionally use Filter instances to filter\n|  records as desired. The base filter class only allows events which are\n|  below a certain point in the logger hierarchy. For example, a filter\n|  initialized with \"A.B\" will allow events logged by loggers \"A.B\",\n|  \"A.B.C\", \"A.B.C.D\", \"A.B.D\" etc. but not \"A.BB\", \"B.A.B\" etc. If\n|  initialized with the empty string, all events are passed.\n|\n|  Methods defined here:\n|\n|  init(self, name='')\n|      Initialize a filter.\n|\n|      Initialize with the name of the logger which, together with its\n|      children, will have its events allowed through the filter. If no\n|      name is specified, allow every event.\n|\n|  filter(self, record)\n|      Determine if the specified record is to be logged.\n|\n|      Returns True if the record should be logged, or False otherwise.\n|      If deemed appropriate, the record may be modified in-place.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n#### class Formatter\n\n|  Formatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)\n|\n|  Formatter instances are used to convert a LogRecord to text.\n|\n|  Formatters need to know how a LogRecord is constructed. They are\n|  responsible for converting a LogRecord to (usually) a string which can\n|  be interpreted by either a human or an external system. The base Formatter\n|  allows a formatting string to be specified. If none is supplied, the\n|  style-dependent default value, \"%(message)s\", \"{message}\", or\n|  \"${message}\", is used.\n|\n|  The Formatter can be initialized with a format string which makes use of\n|  knowledge of the LogRecord attributes - e.g. the default value mentioned\n|  above makes use of the fact that the user's message and arguments are pre-\n|  formatted into a LogRecord's message attribute. Currently, the useful\n|  attributes in a LogRecord are described by:\n|\n|  %(name)s            Name of the logger (logging channel)\n|  %(levelno)s         Numeric logging level for the message (DEBUG, INFO,\n|                      WARNING, ERROR, CRITICAL)\n|  %(levelname)s       Text logging level for the message (\"DEBUG\", \"INFO\",\n|                      \"WARNING\", \"ERROR\", \"CRITICAL\")\n|  %(pathname)s        Full pathname of the source file where the logging\n|                      call was issued (if available)\n|  %(filename)s        Filename portion of pathname\n|  %(module)s          Module (name portion of filename)\n|  %(lineno)d          Source line number where the logging call was issued\n|                      (if available)\n|  %(funcName)s        Function name\n|  %(created)f         Time when the LogRecord was created (time.time()\n|                      return value)\n|  %(asctime)s         Textual time when the LogRecord was created\n|  %(msecs)d           Millisecond portion of the creation time\n|  %(relativeCreated)d Time in milliseconds when the LogRecord was created,\n|                      relative to the time the logging module was loaded\n|                      (typically at application startup time)\n|  %(thread)d          Thread ID (if available)\n|  %(threadName)s      Thread name (if available)\n|  %(process)d         Process ID (if available)\n|  %(message)s         The result of record.getMessage(), computed just as\n|                      the record is emitted\n|\n|  Methods defined here:\n|\n|  init(self, fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)\n|      Initialize the formatter with specified format strings.\n|\n|      Initialize the formatter either with the specified format string, or a\n|      default as described above. Allow for specialized date formatting with\n|      the optional datefmt argument. If datefmt is omitted, you get an\n|      ISO8601-like (or RFC 3339-like) format.\n|\n|      Use a style parameter of '%', '{' or '$' to specify that you want to\n|      use one of %-formatting, :meth:`str.format` (``{}``) formatting or\n|      :class:`string.Template` formatting in your format string.\n|\n|      .. versionchanged:: 3.2\n|         Added the ``style`` parameter.\n|\n|  format(self, record)\n|      Format the specified record as text.\n|\n|      The record's attribute dictionary is used as the operand to a\n|      string formatting operation which yields the returned string.\n|      Before formatting the dictionary, a couple of preparatory steps\n|      are carried out. The message attribute of the record is computed\n|      using LogRecord.getMessage(). If the formatting string uses the\n|      time (as determined by a call to usesTime(), formatTime() is\n|      called to format the event time. If there is exception information,\n|      it is formatted using formatException() and appended to the message.\n|\n|  formatException(self, ei)\n|      Format and return the specified exception information as a string.\n|\n|      This default implementation just uses\n|      traceback.printexception()\n|\n|  formatMessage(self, record)\n|\n|  formatStack(self, stackinfo)\n|      This method is provided as an extension point for specialized\n|      formatting of stack information.\n|\n|      The input data is a string as returned from a call to\n|      :func:`traceback.printstack`, but with the last trailing newline\n|      removed.\n|\n|      The base implementation just returns the value passed in.\n|\n|  formatTime(self, record, datefmt=None)\n|      Return the creation time of the specified LogRecord as formatted text.\n|\n|      This method should be called from format() by a formatter which\n|      wants to make use of a formatted time. This method can be overridden\n|      in formatters to provide for any specific requirement, but the\n|      basic behaviour is as follows: if datefmt (a string) is specified,\n|      it is used with time.strftime() to format the creation time of the\n|      record. Otherwise, an ISO8601-like (or RFC 3339-like) format is used.\n|      The resulting string is returned. This function uses a user-configurable\n|      function to convert the creation time to a tuple. By default,\n|      time.localtime() is used; to change this for a particular formatter\n|      instance, set the 'converter' attribute to a function with the same\n|      signature as time.localtime() or time.gmtime(). To change it for all\n|      formatters, for example if you want all logging times to be shown in GMT,\n|      set the 'converter' attribute in the Formatter class.\n|\n|  usesTime(self)\n|      Check if the format uses the creation time of the record.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  converter = localtime(...)\n|      localtime([seconds]) -> (tmyear,tmmon,tmmday,tmhour,tmmin,\n|                                tmsec,tmwday,tmyday,tmisdst)\n|\n|      Convert seconds since the Epoch to a time tuple expressing local time.\n|      When 'seconds' is not passed in, convert the current time instead.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  defaultmsecformat = '%s,%03d'\n|\n|  defaulttimeformat = '%Y-%m-%d %H:%M:%S'\n\n#### class Handler\n\n|  Handler(level=0)\n|\n|  Handler instances dispatch logging events to specific destinations.\n|\n|  The base handler class. Acts as a placeholder which defines the Handler\n|  interface. Handlers can optionally use Formatter instances to format\n|  records as desired. By default, no formatter is specified; in this case,\n|  the 'raw' message as determined by record.message is logged.\n|\n|  Method resolution order:\n|      Handler\n|      Filterer\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, level=0)\n|      Initializes the instance - basically setting the formatter to None\n|      and the filter list to empty.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  acquire(self)\n|      Acquire the I/O thread lock.\n|\n|  close(self)\n|      Tidy up any resources used by the handler.\n|\n|      This version removes the handler from an internal map of handlers,\n|      handlers, which is used for handler lookup by name. Subclasses\n|      should ensure that this gets called from overridden close()\n|      methods.\n|\n|  createLock(self)\n|      Acquire a thread lock for serializing access to the underlying I/O.\n|\n|  emit(self, record)\n|      Do whatever it takes to actually log the specified logging record.\n|\n|      This version is intended to be implemented by subclasses and so\n|      raises a NotImplementedError.\n|\n|  flush(self)\n|      Ensure all logging output has been flushed.\n|\n|      This version does nothing and is intended to be implemented by\n|      subclasses.\n|\n|  format(self, record)\n|      Format the specified record.\n|\n|      If a formatter is set, use it. Otherwise, use the default formatter\n|      for the module.\n|\n|  getname(self)\n|\n|  handle(self, record)\n|      Conditionally emit the specified logging record.\n|\n|      Emission depends on filters which may have been added to the handler.\n|      Wrap the actual emission of the record with acquisition/release of\n|      the I/O thread lock. Returns whether the filter passed the record for\n|      emission.\n|\n|  handleError(self, record)\n|      Handle errors which occur during an emit() call.\n|\n|      This method should be called from handlers when an exception is\n|      encountered during an emit() call. If raiseExceptions is false,\n|      exceptions get silently ignored. This is what is mostly wanted\n|      for a logging system - most users will not care about errors in\n|      the logging system, they are more interested in application errors.\n|      You could, however, replace this with a custom handler if you wish.\n|      The record which was being processed is passed in to this method.\n|\n|  release(self)\n|      Release the I/O thread lock.\n|\n|  setFormatter(self, fmt)\n|      Set the formatter for this handler.\n|\n|  setLevel(self, level)\n|      Set the logging level of this handler.  level must be an int or a str.\n|\n|  setname(self, name)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  name\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from Filterer:\n|\n|  addFilter(self, filter)\n|      Add the specified filter to this handler.\n|\n|  filter(self, record)\n|      Determine if a record is loggable by consulting all the filters.\n|\n|      The default is to allow the record to be logged; any filter can veto\n|      this and the record is then dropped. Returns a zero value if a record\n|      is to be dropped, else non-zero.\n|\n|      .. versionchanged:: 3.2\n|\n|         Allow filters to be just callables.\n|\n|  removeFilter(self, filter)\n|      Remove the specified filter from this handler.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from Filterer:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n#### class LogRecord\n\n|  LogRecord(name, level, pathname, lineno, msg, args, excinfo, func=None, sinfo=None, kwargs)\n|\n|  A LogRecord instance represents an event being logged.\n|\n|  LogRecord instances are created every time something is logged. They\n|  contain all the information pertinent to the event being logged. The\n|  main information passed in is in msg and args, which are combined\n|  using str(msg) % args to create the message field of the record. The\n|  record also includes information such as when the record was created,\n|  the source line where the logging call was made, and any exception\n|  information to be logged.\n|\n|  Methods defined here:\n|\n|  init(self, name, level, pathname, lineno, msg, args, excinfo, func=None, sinfo=None, kwargs)\n|      Initialize a logging record with interesting information.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  getMessage(self)\n|      Return the message for this LogRecord.\n|\n|      Return the message for this LogRecord after merging any user-supplied\n|      arguments with the message.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n#### class Logger\n\n|  Logger(name, level=0)\n|\n|  Instances of the Logger class represent a single logging channel. A\n|  \"logging channel\" indicates an area of an application. Exactly how an\n|  \"area\" is defined is up to the application developer. Since an\n|  application can have any number of areas, logging channels are identified\n|  by a unique string. Application areas can be nested (e.g. an area\n|  of \"input processing\" might include sub-areas \"read CSV files\", \"read\n|  XLS files\" and \"read Gnumeric files\"). To cater for this natural nesting,\n|  channel names are organized into a namespace hierarchy where levels are\n|  separated by periods, much like the Java or Python package namespace. So\n|  in the instance given above, channel names might be \"input\" for the upper\n|  level, and \"input.csv\", \"input.xls\" and \"input.gnu\" for the sub-levels.\n|  There is no arbitrary limit to the depth of nesting.\n|\n|  Method resolution order:\n|      Logger\n|      Filterer\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, name, level=0)\n|      Initialize the logger with a name and an optional level.\n|\n|  reduce(self)\n|      Helper for pickle.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  addHandler(self, hdlr)\n|      Add the specified handler to this logger.\n|\n|  callHandlers(self, record)\n|      Pass a record to all relevant handlers.\n|\n|      Loop through all handlers for this logger and its parents in the\n|      logger hierarchy. If no handler was found, output a one-off error\n|      message to sys.stderr. Stop searching up the hierarchy whenever a\n|      logger with the \"propagate\" attribute set to zero is found - that\n|      will be the last logger whose handlers are called.\n|\n|  critical(self, msg, *args, kwargs)\n|      Log 'msg % args' with severity 'CRITICAL'.\n|\n|      To pass exception information, use the keyword argument excinfo with\n|      a true value, e.g.\n|\n|      logger.critical(\"Houston, we have a %s\", \"major disaster\", excinfo=1)\n|\n|  debug(self, msg, *args, kwargs)\n|      Log 'msg % args' with severity 'DEBUG'.\n|\n|      To pass exception information, use the keyword argument excinfo with\n|      a true value, e.g.\n|\n|      logger.debug(\"Houston, we have a %s\", \"thorny problem\", excinfo=1)\n|\n|  error(self, msg, *args, kwargs)\n|      Log 'msg % args' with severity 'ERROR'.\n|\n|      To pass exception information, use the keyword argument excinfo with\n|      a true value, e.g.\n|\n|      logger.error(\"Houston, we have a %s\", \"major problem\", excinfo=1)\n|\n|  exception(self, msg, *args, excinfo=True, kwargs)\n|      Convenience method for logging an ERROR with exception information.\n|\n|  fatal(self, msg, *args, kwargs)\n|      Don't use this method, use critical() instead.\n|\n|  findCaller(self, stackinfo=False, stacklevel=1)\n|      Find the stack frame of the caller so that we can note the source\n|      file name, line number and function name.\n|\n|  getChild(self, suffix)\n|      Get a logger which is a descendant to this one.\n|\n|      This is a convenience method, such that\n|\n|      logging.getLogger('abc').getChild('def.ghi')\n|\n|      is the same as\n|\n|      logging.getLogger('abc.def.ghi')\n|\n|      It's useful, for example, when the parent logger is named using\n|      name rather than a literal string.\n|\n|  getEffectiveLevel(self)\n|      Get the effective level for this logger.\n|\n|      Loop through this logger and its parents in the logger hierarchy,\n|      looking for a non-zero logging level. Return the first one found.\n|\n|  handle(self, record)\n|      Call the handlers for the specified record.\n|\n|      This method is used for unpickled records received from a socket, as\n|      well as those created locally. Logger-level filtering is applied.\n|\n|  hasHandlers(self)\n|      See if this logger has any handlers configured.\n|\n|      Loop through all handlers for this logger and its parents in the\n|      logger hierarchy. Return True if a handler was found, else False.\n|      Stop searching up the hierarchy whenever a logger with the \"propagate\"\n|      attribute set to zero is found - that will be the last logger which\n|      is checked for the existence of handlers.\n|\n|  info(self, msg, *args, kwargs)\n|      Log 'msg % args' with severity 'INFO'.\n|\n|      To pass exception information, use the keyword argument excinfo with\n|      a true value, e.g.\n|\n|      logger.info(\"Houston, we have a %s\", \"interesting problem\", excinfo=1)\n|\n|  isEnabledFor(self, level)\n|      Is this logger enabled for level 'level'?\n|\n|  log(self, level, msg, *args, kwargs)\n|      Log 'msg % args' with the integer severity 'level'.\n|\n|      To pass exception information, use the keyword argument excinfo with\n|      a true value, e.g.\n|\n|      logger.log(level, \"We have a %s\", \"mysterious problem\", excinfo=1)\n|\n|  makeRecord(self, name, level, fn, lno, msg, args, excinfo, func=None, extra=None, sinfo=None)\n|      A factory method which can be overridden in subclasses to create\n|      specialized LogRecords.\n|\n|  removeHandler(self, hdlr)\n|      Remove the specified handler from this logger.\n|\n|  setLevel(self, level)\n|      Set the logging level of this logger.  level must be an int or a str.\n|\n|  warn(self, msg, *args, kwargs)\n|\n|  warning(self, msg, *args, kwargs)\n|      Log 'msg % args' with severity 'WARNING'.\n|\n|      To pass exception information, use the keyword argument excinfo with\n|      a true value, e.g.\n|\n|      logger.warning(\"Houston, we have a %s\", \"bit of a problem\", excinfo=1)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  manager = <logging.Manager object>\n|\n|  root = <RootLogger root (WARNING)>\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from Filterer:\n|\n|  addFilter(self, filter)\n|      Add the specified filter to this handler.\n|\n|  filter(self, record)\n|      Determine if a record is loggable by consulting all the filters.\n|\n|      The default is to allow the record to be logged; any filter can veto\n|      this and the record is then dropped. Returns a zero value if a record\n|      is to be dropped, else non-zero.\n|\n|      .. versionchanged:: 3.2\n|\n|         Allow filters to be just callables.\n|\n|  removeFilter(self, filter)\n|      Remove the specified filter from this handler.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from Filterer:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n#### class LoggerAdapter\n\n|  LoggerAdapter(logger, extra=None)\n|\n|  An adapter for loggers which makes it easier to specify contextual\n|  information in logging output.\n|\n|  Methods defined here:\n|\n|  init(self, logger, extra=None)\n|      Initialize the adapter with a logger and a dict-like object which\n|      provides contextual information. This constructor signature allows\n|      easy stacking of LoggerAdapters, if so desired.\n|\n|      You can effectively pass keyword arguments as shown in the\n|      following example:\n|\n|      adapter = LoggerAdapter(someLogger, dict(p1=v1, p2=\"v2\"))\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  critical(self, msg, *args, kwargs)\n|      Delegate a critical call to the underlying logger.\n|\n|  debug(self, msg, *args, kwargs)\n|      Delegate a debug call to the underlying logger.\n|\n|  error(self, msg, *args, kwargs)\n|      Delegate an error call to the underlying logger.\n|\n|  exception(self, msg, *args, excinfo=True, kwargs)\n|      Delegate an exception call to the underlying logger.\n|\n|  getEffectiveLevel(self)\n|      Get the effective level for the underlying logger.\n|\n|  hasHandlers(self)\n|      See if the underlying logger has any handlers.\n|\n|  info(self, msg, *args, kwargs)\n|      Delegate an info call to the underlying logger.\n|\n|  isEnabledFor(self, level)\n|      Is this logger enabled for level 'level'?\n|\n|  log(self, level, msg, *args, kwargs)\n|      Delegate a log call to the underlying logger, after adding\n|      contextual information from this adapter instance.\n|\n|  process(self, msg, kwargs)\n|      Process the logging message and keyword arguments passed in to\n|      a logging call to insert contextual information. You can either\n|      manipulate the message itself, the keyword args or both. Return\n|      the message and kwargs modified (or not) to suit your needs.\n|\n|      Normally, you'll only need to override this one method in a\n|      LoggerAdapter subclass for your specific needs.\n|\n|  setLevel(self, level)\n|      Set the specified level on the underlying logger.\n|\n|  warn(self, msg, *args, kwargs)\n|\n|  warning(self, msg, *args, kwargs)\n|      Delegate a warning call to the underlying logger.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  name\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  manager\n\n#### class NullHandler\n\n|  NullHandler(level=0)\n|\n|  This handler does nothing. It's intended to be used to avoid the\n|  \"No handlers could be found for logger XXX\" one-off warning. This is\n|  important for library code, which may contain code to log events. If a user\n|  of the library does not configure logging, the one-off warning might be\n|  produced; to avoid this, the library developer simply needs to instantiate\n|  a NullHandler and add it to the top-level logger of the library module or\n|  package.\n|\n|  Method resolution order:\n|      NullHandler\n|      Handler\n|      Filterer\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  createLock(self)\n|      Acquire a thread lock for serializing access to the underlying I/O.\n|\n|  emit(self, record)\n|      Stub.\n|\n|  handle(self, record)\n|      Stub.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from Handler:\n|\n|  init(self, level=0)\n|      Initializes the instance - basically setting the formatter to None\n|      and the filter list to empty.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  acquire(self)\n|      Acquire the I/O thread lock.\n|\n|  close(self)\n|      Tidy up any resources used by the handler.\n|\n|      This version removes the handler from an internal map of handlers,\n|      handlers, which is used for handler lookup by name. Subclasses\n|      should ensure that this gets called from overridden close()\n|      methods.\n|\n|  flush(self)\n|      Ensure all logging output has been flushed.\n|\n|      This version does nothing and is intended to be implemented by\n|      subclasses.\n|\n|  format(self, record)\n|      Format the specified record.\n|\n|      If a formatter is set, use it. Otherwise, use the default formatter\n|      for the module.\n|\n|  getname(self)\n|\n|  handleError(self, record)\n|      Handle errors which occur during an emit() call.\n|\n|      This method should be called from handlers when an exception is\n|      encountered during an emit() call. If raiseExceptions is false,\n|      exceptions get silently ignored. This is what is mostly wanted\n|      for a logging system - most users will not care about errors in\n|      the logging system, they are more interested in application errors.\n|      You could, however, replace this with a custom handler if you wish.\n|      The record which was being processed is passed in to this method.\n|\n|  release(self)\n|      Release the I/O thread lock.\n|\n|  setFormatter(self, fmt)\n|      Set the formatter for this handler.\n|\n|  setLevel(self, level)\n|      Set the logging level of this handler.  level must be an int or a str.\n|\n|  setname(self, name)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from Handler:\n|\n|  name\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from Filterer:\n|\n|  addFilter(self, filter)\n|      Add the specified filter to this handler.\n|\n|  filter(self, record)\n|      Determine if a record is loggable by consulting all the filters.\n|\n|      The default is to allow the record to be logged; any filter can veto\n|      this and the record is then dropped. Returns a zero value if a record\n|      is to be dropped, else non-zero.\n|\n|      .. versionchanged:: 3.2\n|\n|         Allow filters to be just callables.\n|\n|  removeFilter(self, filter)\n|      Remove the specified filter from this handler.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from Filterer:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n#### class StreamHandler\n\n|  StreamHandler(stream=None)\n|\n|  A handler class which writes logging records, appropriately formatted,\n|  to a stream. Note that this class does not close the stream, as\n|  sys.stdout or sys.stderr may be used.\n|\n|  Method resolution order:\n|      StreamHandler\n|      Handler\n|      Filterer\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, stream=None)\n|      Initialize the handler.\n|\n|      If stream is not specified, sys.stderr is used.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  emit(self, record)\n|      Emit a record.\n|\n|      If a formatter is specified, it is used to format the record.\n|      The record is then written to the stream with a trailing newline.  If\n|      exception information is present, it is formatted using\n|      traceback.printexception and appended to the stream.  If the stream\n|      has an 'encoding' attribute, it is used to determine how to do the\n|      output to the stream.\n|\n|  flush(self)\n|      Flushes the stream.\n|\n|  setStream(self, stream)\n|      Sets the StreamHandler's stream to the specified value,\n|      if it is different.\n|\n|      Returns the old stream, if the stream was changed, or None\n|      if it wasn't.\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  terminator = '\\n'\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from Handler:\n|\n|  acquire(self)\n|      Acquire the I/O thread lock.\n|\n|  close(self)\n|      Tidy up any resources used by the handler.\n|\n|      This version removes the handler from an internal map of handlers,\n|      handlers, which is used for handler lookup by name. Subclasses\n|      should ensure that this gets called from overridden close()\n|      methods.\n|\n|  createLock(self)\n|      Acquire a thread lock for serializing access to the underlying I/O.\n|\n|  format(self, record)\n|      Format the specified record.\n|\n|      If a formatter is set, use it. Otherwise, use the default formatter\n|      for the module.\n|\n|  getname(self)\n|\n|  handle(self, record)\n|      Conditionally emit the specified logging record.\n|\n|      Emission depends on filters which may have been added to the handler.\n|      Wrap the actual emission of the record with acquisition/release of\n|      the I/O thread lock. Returns whether the filter passed the record for\n|      emission.\n|\n|  handleError(self, record)\n|      Handle errors which occur during an emit() call.\n|\n|      This method should be called from handlers when an exception is\n|      encountered during an emit() call. If raiseExceptions is false,\n|      exceptions get silently ignored. This is what is mostly wanted\n|      for a logging system - most users will not care about errors in\n|      the logging system, they are more interested in application errors.\n|      You could, however, replace this with a custom handler if you wish.\n|      The record which was being processed is passed in to this method.\n|\n|  release(self)\n|      Release the I/O thread lock.\n|\n|  setFormatter(self, fmt)\n|      Set the formatter for this handler.\n|\n|  setLevel(self, level)\n|      Set the logging level of this handler.  level must be an int or a str.\n|\n|  setname(self, name)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from Handler:\n|\n|  name\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from Filterer:\n|\n|  addFilter(self, filter)\n|      Add the specified filter to this handler.\n|\n|  filter(self, record)\n|      Determine if a record is loggable by consulting all the filters.\n|\n|      The default is to allow the record to be logged; any filter can veto\n|      this and the record is then dropped. Returns a zero value if a record\n|      is to be dropped, else non-zero.\n|\n|      .. versionchanged:: 3.2\n|\n|         Allow filters to be just callables.\n|\n|  removeFilter(self, filter)\n|      Remove the specified filter from this handler.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from Filterer:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n### FUNCTIONS\n\n#### addLevelName\n\nAssociate 'levelName' with 'level'.\n\nThis is used when converting levels to text during message formatting.\n\n#### basicConfig\n\nDo basic configuration for the logging system.\n\nThis function does nothing if the root logger already has handlers\nconfigured, unless the keyword argument *force* is set to ``True``.\nIt is a convenience method intended for use by simple scripts\nto do one-shot configuration of the logging package.\n\nThe default behaviour is to create a StreamHandler which writes to\nsys.stderr, set a formatter using the BASICFORMAT format string, and\nadd the handler to the root logger.\n\nA number of optional keyword arguments may be specified, which can alter\nthe default behaviour.\n\nfilename  Specifies that a FileHandler be created, using the specified\nfilename, rather than a StreamHandler.\nfilemode  Specifies the mode to open the file, if filename is specified\n(if filemode is unspecified, it defaults to 'a').\nformat    Use the specified format string for the handler.\ndatefmt   Use the specified date/time format.\nstyle     If a format string is specified, use this to specify the\ntype of format string (possible values '%', '{', '$', for\n%-formatting, :meth:`str.format` and :class:`string.Template`\n- defaults to '%').\nlevel     Set the root logger level to the specified level.\nstream    Use the specified stream to initialize the StreamHandler. Note\nthat this argument is incompatible with 'filename' - if both\nare present, 'stream' is ignored.\nhandlers  If specified, this should be an iterable of already created\nhandlers, which will be added to the root handler. Any handler\nin the list which does not have a formatter assigned will be\nassigned the formatter created in this function.\nforce     If this keyword  is specified as true, any existing handlers\nattached to the root logger are removed and closed, before\ncarrying out the configuration as specified by the other\narguments.\nencoding  If specified together with a filename, this encoding is passed to\nthe created FileHandler, causing it to be used when the file is\nopened.\nerrors    If specified together with a filename, this value is passed to the\ncreated FileHandler, causing it to be used when the file is\nopened in text mode. If not specified, the default value is\n`backslashreplace`.\n\nNote that you could specify a stream created using open(filename, mode)\nrather than passing the filename and mode in. However, it should be\nremembered that StreamHandler does not close its stream (since it may be\nusing sys.stdout or sys.stderr), whereas FileHandler closes its stream\nwhen the handler is closed.\n\n.. versionchanged:: 3.2\nAdded the ``style`` parameter.\n\n.. versionchanged:: 3.3\nAdded the ``handlers`` parameter. A ``ValueError`` is now thrown for\nincompatible arguments (e.g. ``handlers`` specified together with\n``filename``/``filemode``, or ``filename``/``filemode`` specified\ntogether with ``stream``, or ``handlers`` specified together with\n``stream``.\n\n.. versionchanged:: 3.8\nAdded the ``force`` parameter.\n\n.. versionchanged:: 3.9\nAdded the ``encoding`` and ``errors`` parameters.\n\n#### captureWarnings\n\nIf capture is true, redirect all warnings to the logging package.\nIf capture is False, ensure that warnings are not redirected to logging\nbut to their original destinations.\n\n#### critical\n\nLog a message with severity 'CRITICAL' on the root logger. If the logger\nhas no handlers, call basicConfig() to add a console handler with a\npre-defined format.\n\n#### debug\n\nLog a message with severity 'DEBUG' on the root logger. If the logger has\nno handlers, call basicConfig() to add a console handler with a pre-defined\nformat.\n\n#### disable\n\nDisable all logging calls of severity 'level' and below.\n\n#### error\n\nLog a message with severity 'ERROR' on the root logger. If the logger has\nno handlers, call basicConfig() to add a console handler with a pre-defined\nformat.\n\n#### exception\n\nLog a message with severity 'ERROR' on the root logger, with exception\ninformation. If the logger has no handlers, basicConfig() is called to add\na console handler with a pre-defined format.\n\n#### fatal\n\nDon't use this function, use critical() instead.\n\n#### getLevelName\n\nReturn the textual or numeric representation of logging level 'level'.\n\nIf the level is one of the predefined levels (CRITICAL, ERROR, WARNING,\nINFO, DEBUG) then you get the corresponding string. If you have\nassociated levels with names using addLevelName then the name you have\nassociated with 'level' is returned.\n\nIf a numeric value corresponding to one of the defined levels is passed\nin, the corresponding string representation is returned.\n\nIf a string representation of the level is passed in, the corresponding\nnumeric value is returned.\n\nIf no matching numeric or string value is passed in, the string\n'Level %s' % level is returned.\n\n#### getLogRecordFactory\n\nReturn the factory to be used when instantiating a log record.\n\n#### getLogger\n\nReturn a logger with the specified name, creating it if necessary.\n\nIf no name is specified, return the root logger.\n\n#### getLoggerClass\n\nReturn the class to be used when instantiating a logger.\n\n#### info\n\nLog a message with severity 'INFO' on the root logger. If the logger has\nno handlers, call basicConfig() to add a console handler with a pre-defined\nformat.\n\n#### log\n\nLog 'msg % args' with the integer severity 'level' on the root logger. If\nthe logger has no handlers, call basicConfig() to add a console handler\nwith a pre-defined format.\n\n#### makeLogRecord\n\nMake a LogRecord whose attributes are defined by the specified dictionary,\nThis function is useful for converting a logging event received over\na socket connection (which is sent as a dictionary) into a LogRecord\ninstance.\n\n#### setLogRecordFactory\n\nSet the factory to be used when instantiating a log record.\n\n:param factory: A callable which will be called to instantiate\na log record.\n\n#### setLoggerClass\n\nSet the class to be used when instantiating a logger. The class should\ndefine init() such that only a name argument is required, and the\ninit() should call Logger.init()\n\n#### shutdown\n\nPerform any cleanup actions in the logging system (e.g. flushing\nbuffers).\n\nShould be called at application exit.\n\n#### warn\n\n#### warning\n\nLog a message with severity 'WARNING' on the root logger. If the logger has\nno handlers, call basicConfig() to add a console handler with a pre-defined\nformat.\n\n### DATA\n\nBASICFORMAT = '%(levelname)s:%(name)s:%(message)s'\nCRITICAL = 50\nDEBUG = 10\nERROR = 40\nFATAL = 50\nINFO = 20\nNOTSET = 0\nWARN = 30\nWARNING = 30\nall = ['BASICFORMAT', 'BufferingFormatter', 'CRITICAL', 'DEBUG', ...\nstatus = 'production'\nlastResort = <StderrHandler <stderr> (WARNING)>\nraiseExceptions = True\n\n### VERSION\n\n0.5.1.2\n\n### DATE\n\n07 February 2010\n\n### AUTHOR\n\nVinay Sajip <vinaysajip@red-dove.com>\n\n### FILE\n\n/usr/lib/python3.10/logging/init.py\n\n"
        }
    ],
    "structuredContent": {
        "command": "logging",
        "section": "",
        "mode": "pydoc",
        "summary": "logging",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "MODULE REFERENCE",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "PACKAGE CONTENTS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 13,
                "subsections": [
                    {
                        "name": "class BufferingFormatter",
                        "lines": 28
                    },
                    {
                        "name": "class FileHandler",
                        "lines": 130
                    },
                    {
                        "name": "class Filter",
                        "lines": 35
                    },
                    {
                        "name": "class Formatter",
                        "lines": 135
                    },
                    {
                        "name": "class Handler",
                        "lines": 121
                    },
                    {
                        "name": "class LogRecord",
                        "lines": 35
                    },
                    {
                        "name": "class Logger",
                        "lines": 187
                    },
                    {
                        "name": "class LoggerAdapter",
                        "lines": 81
                    },
                    {
                        "name": "class NullHandler",
                        "lines": 118
                    },
                    {
                        "name": "class StreamHandler",
                        "lines": 136
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "addLevelName",
                        "lines": 4
                    },
                    {
                        "name": "basicConfig",
                        "lines": 66
                    },
                    {
                        "name": "captureWarnings",
                        "lines": 4
                    },
                    {
                        "name": "critical",
                        "lines": 4
                    },
                    {
                        "name": "debug",
                        "lines": 4
                    },
                    {
                        "name": "disable",
                        "lines": 2
                    },
                    {
                        "name": "error",
                        "lines": 4
                    },
                    {
                        "name": "exception",
                        "lines": 4
                    },
                    {
                        "name": "fatal",
                        "lines": 2
                    },
                    {
                        "name": "getLevelName",
                        "lines": 16
                    },
                    {
                        "name": "getLogRecordFactory",
                        "lines": 2
                    },
                    {
                        "name": "getLogger",
                        "lines": 4
                    },
                    {
                        "name": "getLoggerClass",
                        "lines": 2
                    },
                    {
                        "name": "info",
                        "lines": 4
                    },
                    {
                        "name": "log",
                        "lines": 4
                    },
                    {
                        "name": "makeLogRecord",
                        "lines": 5
                    },
                    {
                        "name": "setLogRecordFactory",
                        "lines": 5
                    },
                    {
                        "name": "setLoggerClass",
                        "lines": 4
                    },
                    {
                        "name": "shutdown",
                        "lines": 5
                    },
                    {
                        "name": "warn",
                        "lines": 1
                    },
                    {
                        "name": "warning",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "DATA",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DATE",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}