go_logging.py 594 B

12345678910111213141516171819202122232425262728293031
  1. """
  2. GO_Logging - logging tools
  3. """
  4. def defaultLogger( name=None ) :
  5. """
  6. Return simple logger to standard output.
  7. """
  8. # external:
  9. import logging
  10. import sys
  11. # new logger instance, or receive the logger with the provided name:
  12. logger = logging.getLogger(name)
  13. # no handlers yet ?
  14. if len(logger.handlers) == 0 :
  15. # add handler to standard output:
  16. logger.addHandler(logging.StreamHandler(sys.stdout))
  17. # let logger print all messages:
  18. logger.setLevel(0)
  19. #endif
  20. # ok
  21. return logger
  22. #enddef