Python logging 模块,capturewarnings() 实例源码

我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用logging.capturewarnings()

项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:django-cryptography    作者:georgemarshall    | 项目源码 | 文件源码
def run(self):
        if self.verbosity > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        TestCommand.run(self)
        if self.verbosity > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:DjangoBlog    作者:0daybug    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:wanblog    作者:wanzifa    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:tabmaster    作者:NicolasMinghetti    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:trydjango18    作者:lucifer-yqh    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:trydjango18    作者:wei0104    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:logo-gen    作者:jellene4eva    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:gmail_scanner    作者:brandonhub    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:djanoDoc    作者:JustinChavez    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:tissuelab    作者:VirtualPlants    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if int(options['verbosity']) > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if int(options['verbosity']) > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:geekpoint    作者:Lujinghu    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:django-next-train    作者:bitpixdigital    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:DjangoZeroToHero    作者:RayParra    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:Roboism    作者:markroxor    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)
项目:django-wechat-api    作者:crazy-canux    | 项目源码 | 文件源码
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)