logutils.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. # File: logutils.py
  2. # Library: DOPAL - DO Python Azureus Library
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; version 2 of the License.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details ( see the COPYING file ).
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. '''
  17. Module containing various logging-related utilities and classes.
  18. '''
  19. # From:
  20. # http://news.hping.org/comp.lang.python.archive/19937.html
  21. def noConfig():
  22. '''
  23. This function should be called to indicate that you are explicitly
  24. notifying the logging module that you do not intend to add any
  25. handlers to the root logger.
  26. This suppresses the warning C{No handlers could be found for logger
  27. "root"} from being emitted. This function performs the following
  28. call to disable the warning::
  29. logging.root.manager.emittedNoHandlerWarning = True
  30. '''
  31. import logging
  32. logging.root.manager.emittedNoHandlerWarning = True