{"id":4842,"library":"verboselogs","title":"Verbose Logging Levels","description":"The `verboselogs` package extends Python's standard `logging` module by introducing additional log levels: NOTICE, SPAM, SUCCESS, and VERBOSE. These levels are strategically positioned within the existing hierarchy (e.g., NOTICE between WARNING and INFO, VERBOSE between INFO and DEBUG) to provide more granular control over log output. Version 1.7 is currently active, and its release cadence has been stable, with the last update in 2017.","status":"active","version":"1.7","language":"en","source_language":"en","source_url":"https://github.com/xolox/python-verboselogs","tags":["logging","utility","verbosity"],"install":[{"cmd":"pip install verboselogs","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"VerboseLogger","correct":"from verboselogs import VerboseLogger"},{"symbol":"NOTICE","correct":"import verboselogs; verboselogs.NOTICE"},{"symbol":"SPAM","correct":"import verboselogs; verboselogs.SPAM"},{"symbol":"SUCCESS","correct":"import verboselogs; verboselogs.SUCCESS"},{"symbol":"VERBOSE","correct":"import verboselogs; verboselogs.VERBOSE"}],"quickstart":{"code":"import logging\nimport verboselogs\n\nlogger = verboselogs.VerboseLogger('my-app')\nlogger.addHandler(logging.StreamHandler())\nlogger.setLevel(verboselogs.VERBOSE)\n\nlogger.spam('This is a SPAM message.')\nlogger.verbose('This is a VERBOSE message, providing detailed info.')\nlogger.debug('This is a standard DEBUG message.')\nlogger.info('This is a standard INFO message.')\nlogger.notice('This is a NOTICE message, between INFO and WARNING.')\nlogger.success('This is a SUCCESS message, confirming an operation.')\nlogger.warning('This is a standard WARNING message.')","lang":"python","description":"Initialize a VerboseLogger, add a stream handler, and set the logging level to VERBOSE to see messages from VERBOSE and higher levels, including custom levels like SPAM, NOTICE, and SUCCESS. The example demonstrates logging at various levels."},"warnings":[{"fix":"Use `logger = verboselogs.VerboseLogger('my_logger_name')` for all instances where custom levels are required, or call `verboselogs.install()` early in your application to make `logging.getLogger()` return a `VerboseLogger` instance.","message":"Mixing standard `logging.getLogger()` with `verboselogs.VerboseLogger()` for the same logger name can lead to unexpected behavior if not handled carefully. Always ensure you consistently use `VerboseLogger` for loggers where custom levels are expected, or explicitly call `verboselogs.install()` to patch the root logger.","severity":"gotcha","affected_versions":"All"},{"fix":"Explicitly set `setLevel()` on your handlers and the logger itself to `verboselogs.SPAM`, `verboselogs.VERBOSE`, or `logging.DEBUG` to ensure all desired messages are processed. For example, `handler.setLevel(verboselogs.SPAM)`.","message":"When integrating with other logging configuration methods (e.g., `logging.basicConfig` or file-based configurations), ensure that the log level of handlers and formatters is set appropriately to allow the new, lower `SPAM` and `VERBOSE` levels to pass through. Default configurations often filter out anything below `INFO` or `WARNING`.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}