# Path: turbo/log.py
# PY3 = sys.version_info >= (3,)
# def _init_file_logger(logger, level, log_path, log_size, log_count):
# def _init_stream_logger(logger, level=None):
# def _module_logger(path):
# def getLogger(currfile=None, level=None, log_path=None, log_size=500 * 1024 * 1024, log_count=3):


import os
import logging
from turbo import log
from util import unittest
    def tearDown(self):
        pass

    def test_get_logger(self):
        # module file log
        self.assertEqual(test_log.name, test_log_name)

        # root logger
        self.assertEqual(log.getLogger(), logging.root)
        self.assertEqual(len(log.getLogger(log_path='root.log').handlers), 2)
        self.assertEqual(len(log.getLogger(log_path='root2.log').handlers), 2)
        self.assertEqual(
            len(log.getLogger(level=logging.WARNING, log_path='root3.log').handlers), 3)

        # normal logger no handlers
        logger_one = log.getLogger('logger.one')
        self.assertEqual(logger_one.name, 'logger.one')
        self.assertEqual(len(logger_one.handlers), 0)

        # file handler one level only have only handler
        logger_two = log.getLogger(
            'logger.two', logging.DEBUG, 'logger_test.log')
        self.assertEqual(logger_two.level, logging.DEBUG)
        self.assertEqual(len(logger_two.handlers), 1)

        logger_two_2 = log.getLogger(
            'logger.two', logging.DEBUG, 'logger_test2.log')
        self.assertEqual(logger_two_2.level, logging.DEBUG)
        self.assertEqual(len(logger_two.handlers), 1)


# Path: turbo/log.py
# PY3 = sys.version_info >= (3,)
# def _init_file_logger(logger, level, log_path, log_size, log_count):
# def _init_stream_logger(logger, level=None):
# def _module_logger(path):
# def getLogger(currfile=None, level=None, log_path=None, log_size=500 * 1024 * 1024, log_count=3):


# Path: tests/log_test.py
import os
import logging
from turbo import log
from util import unittest

    def tearDown(self):
        pass

    def test_get_logger(self):
        # module file log
        self.assertEqual(test_log.name, test_log_name)

        # root logger
        self.assertEqual(log.getLogger(), logging.root)
        self.assertEqual(len(log.getLogger(log_path='root.log').handlers), 2)
        self.assertEqual(len(log.getLogger(log_path='root2.log').handlers), 2)
        self.assertEqual(
            len(log.getLogger(level=logging.WARNING, log_path='root3.log').handlers), 3)

        # normal logger no handlers
        logger_one = log.getLogger('logger.one')
        self.assertEqual(logger_one.name, 'logger.one')
        self.assertEqual(len(logger_one.handlers), 0)

        # file handler one level only have only handler
        logger_two = log.getLogger(
            'logger.two', logging.DEBUG, 'logger_test.log')
        self.assertEqual(logger_two.level, logging.DEBUG)
        self.assertEqual(len(logger_two.handlers), 1)

        logger_two_2 = log.getLogger(
            'logger.two', logging.DEBUG, 'logger_test2.log')
        self.assertEqual(logger_two_2.level, logging.DEBUG)
        self.assertEqual(len(logger_two.handlers), 1)


        logger_two_3 = log.getLogger(