Did I find the right examples for you? yes no

All Samples(20)  |  Call(10)  |  Derive(0)  |  Import(10)
Sets up a logger (if no handlers exist) for console output,
and file 'tee' output if desired.

        def setup_logger(logger, stream, filename=None, fmt=None):
    """Sets up a logger (if no handlers exist) for console output,
    and file 'tee' output if desired."""
    if len(logger.handlers) < 1:
        console = logging.StreamHandler(stream)
        console.setLevel(logging.DEBUG)
        console.setFormatter(logging.Formatter(fmt))
        logger.addHandler(console)
        logger.setLevel(logging.DEBUG)

        if filename:
            outfile = logging.FileHandler(filename)
            outfile.setLevel(logging.INFO)
            outfile.setFormatter(logging.Formatter("%(asctime)s " + (fmt if fmt else '%(message)s')))
            logger.addHandler(outfile)
        


src/r/o/rolf-HEAD/ve/lib/python2.7/site-packages/django_extensions/management/commands/mail_debug.py   rolf(Download)
from django_extensions.management.utils import setup_logger
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from smtpd import SMTPServer
import sys
 
        # Add console handler
        setup_logger(logger, stream=self.stdout, filename=options.get('output_file', None))
 
        def inner_run():

src/a/n/antisocial-HEAD/ve/lib/python2.7/site-packages/django_extensions/management/commands/mail_debug.py   antisocial(Download)
from django_extensions.management.utils import setup_logger
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from smtpd import SMTPServer
import sys
 
        # Add console handler
        setup_logger(logger, stream=self.stdout, filename=options.get('output_file', None))
 
        def inner_run():

src/k/a/ka-lite-HEAD/python-packages/django_extensions/management/commands/mail_debug.py   ka-lite(Download)
from django_extensions.management.utils import setup_logger
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from smtpd import SMTPServer
import sys
 
        # Add console handler
        setup_logger(logger, stream=self.stdout, filename=options.get('output_file', None))
 
        def inner_run():

src/d/j/django-extensions-1.3.3/django_extensions/management/commands/mail_debug.py   django-extensions(Download)
from django_extensions.management.utils import setup_logger
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from smtpd import SMTPServer
import sys
 
        # Add console handler
        setup_logger(logger, stream=self.stdout, filename=options.get('output_file', None))
 
        def inner_run():

src/d/j/django-extensions-HEAD/django_extensions/management/commands/mail_debug.py   django-extensions(Download)
from django_extensions.management.utils import setup_logger
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from smtpd import SMTPServer
import sys
 
        # Add console handler
        setup_logger(logger, stream=self.stdout, filename=options.get('output_file', None))
 
        def inner_run():

src/r/o/rolf-HEAD/ve/lib/python2.7/site-packages/django_extensions/management/commands/runserver_plus.py   rolf(Download)
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django_extensions.management.utils import setup_logger, RedirectHandler
from optparse import make_option
import os
    def handle(self, addrport='', *args, **options):
        import django
 
        setup_logger(logger, self.stderr, filename=options.get('output_file', None))  # , fmt="[%(name)s] %(message)s")
        logredirect = RedirectHandler(__name__)

src/a/n/antisocial-HEAD/ve/lib/python2.7/site-packages/django_extensions/management/commands/runserver_plus.py   antisocial(Download)
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django_extensions.management.utils import setup_logger, RedirectHandler
from optparse import make_option
import os
    def handle(self, addrport='', *args, **options):
        import django
 
        setup_logger(logger, self.stderr, filename=options.get('output_file', None))  # , fmt="[%(name)s] %(message)s")
        logredirect = RedirectHandler(__name__)

src/k/a/ka-lite-HEAD/python-packages/django_extensions/management/commands/runserver_plus.py   ka-lite(Download)
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django_extensions.management.utils import setup_logger, RedirectHandler
from optparse import make_option
import os
    def handle(self, addrport='', *args, **options):
        import django
 
        setup_logger(logger, self.stderr, filename=options.get('output_file', None))  # , fmt="[%(name)s] %(message)s")
        logredirect = RedirectHandler(__name__)

src/d/j/django-extensions-1.3.3/django_extensions/management/commands/runserver_plus.py   django-extensions(Download)
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django_extensions.management.utils import setup_logger, RedirectHandler
from django_extensions.management.technical_response import null_technical_500_response
 
    def handle(self, addrport='', *args, **options):
        import django
 
        setup_logger(logger, self.stderr, filename=options.get('output_file', None))  # , fmt="[%(name)s] %(message)s")
        logredirect = RedirectHandler(__name__)

src/d/j/django-extensions-HEAD/django_extensions/management/commands/runserver_plus.py   django-extensions(Download)
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django_extensions.management.utils import setup_logger, RedirectHandler
from django_extensions.management.technical_response import null_technical_500_response
 
    def handle(self, addrport='', *args, **options):
        import django
 
        setup_logger(logger, self.stderr, filename=options.get('output_file', None))  # , fmt="[%(name)s] %(message)s")
        logredirect = RedirectHandler(__name__)