Ejemplo n.º 1
0
 def test_setup_logger_no_handlers_file(self):
     l = self.get_logger()
     l.handlers = []
     tempfile = mktemp(suffix='unittest', prefix='celery')
     l = self.setup_logger(logfile=tempfile, loglevel=0, root=False)
     self.assertIsInstance(get_handlers(l)[0],
                           logging.FileHandler)
Ejemplo n.º 2
0
 def test_setup_logger_no_handlers_file(self):
     l = self.get_logger()
     set_handlers(l, [])
     tempfile = mktemp(suffix="unittest", prefix="celery")
     l = self.setup_logger(logfile=tempfile, loglevel=0, root=False)
     self.assertIsInstance(get_handlers(l)[0],
                           logging.FileHandler)
Ejemplo n.º 3
0
 def test_setup_logger(self):
     logger = self.setup_logger(loglevel=logging.ERROR, logfile=None, root=False, colorize=True)
     logger.handlers = []
     Logging._setup = False
     logger = self.setup_logger(loglevel=logging.ERROR, logfile=None, root=False, colorize=None)
     print(logger.handlers)
     self.assertIs(
         get_handlers(logger)[0].stream, sys.__stderr__, "setup_logger logs to stderr without logfile argument."
     )
Ejemplo n.º 4
0
 def test_setup_logger(self):
     logger = self.setup_logger(loglevel=logging.ERROR, logfile=None, root=False, colorize=True)
     set_handlers(logger, [])
     logger = self.setup_logger(loglevel=logging.ERROR, logfile=None, root=False, colorize=None)
     self.assertIs(
         get_handlers(logger)[0].stream, sys.__stderr__, "setup_logger logs to stderr without logfile argument."
     )
     self.assertDidLogFalse(
         logger, "Logging something", "Logger doesn't info when loglevel is ERROR", loglevel=logging.INFO
     )
Ejemplo n.º 5
0
 def test_setup_logger(self):
     logger = self.setup_logger(loglevel=logging.ERROR, logfile=None,
                                root=False, colorize=True)
     set_handlers(logger, [])
     logger = self.setup_logger(loglevel=logging.ERROR, logfile=None,
                                root=False, colorize=None)
     self.assertIs(get_handlers(logger)[0].stream, sys.__stderr__,
             "setup_logger logs to stderr without logfile argument.")
     self.assertDidLogFalse(logger, "Logging something",
             "Logger doesn't info when loglevel is ERROR",
             loglevel=logging.INFO)
Ejemplo n.º 6
0
 def test_setup_logger(self):
     logger = self.setup_logger(loglevel=logging.ERROR, logfile=None,
                                root=False, colorize=True)
     logger.handlers = []
     Logging._setup = False
     logger = self.setup_logger(loglevel=logging.ERROR, logfile=None,
                                root=False, colorize=None)
     self.assertIs(
         get_handlers(logger)[0].stream, sys.__stderr__,
         'setup_logger logs to stderr without logfile argument.',
     )