Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: binarydud/pyres
...
head fork: binarydud/pyres
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Showing with 10 additions and 7 deletions.
  1. +10 −7 pyres/__init__.py
View
17 pyres/__init__.py
@@ -8,6 +8,8 @@
import sys
import logging
+logger = logging.getLogger(__name__)
+
def special_log_file(filename):
if filename in ("stderr", "stdout"):
return True
@@ -56,7 +58,8 @@ def get_logging_handler(filename, procname, namespace=None):
def setup_logging(procname, log_level=logging.INFO, filename=None):
if log_level == logging.NOTSET:
return
- logger = logging.getLogger()
+ main_package = __name__.split('.', 1)[0] if '.' in __name__ else __name__
+ logger = logging.getLogger(main_package)
logger.setLevel(log_level)
handler = get_logging_handler(filename, procname)
logger.addHandler(handler)
@@ -214,18 +217,18 @@ def enqueue(self, klass, *args):
class_name = '%s.%s' % (klass.__module__, klass.__name__)
self.enqueue_from_string(class_name, queue, *args)
else:
- logging.warning("unable to enqueue job with class %s" % str(klass))
+ logger.warning("unable to enqueue job with class %s" % str(klass))
def enqueue_from_string(self, klass_as_string, queue, *args, **kwargs):
payload = {'class':klass_as_string, 'args':args, 'enqueue_timestamp': time.time()}
if 'first_attempt' in kwargs:
payload['first_attempt'] = kwargs['first_attempt']
self.push(queue, payload)
- logging.info("enqueued '%s' job on queue %s" % (klass_as_string, queue))
+ logger.info("enqueued '%s' job on queue %s" % (klass_as_string, queue))
if args:
- logging.debug("job arguments: %s" % str(args))
+ logger.debug("job arguments: %s" % str(args))
else:
- logging.debug("no arguments passed in.")
+ logger.debug("no arguments passed in.")
def queues(self):
return self.redis.smembers("resque:queues") or []
@@ -284,10 +287,10 @@ def enqueue_at(self, datetime, klass, *args, **kwargs):
self.enqueue_at_from_string(datetime, class_name, klass.queue, *args, **kwargs)
def enqueue_at_from_string(self, datetime, klass_as_string, queue, *args, **kwargs):
- logging.info("scheduled '%s' job on queue %s for execution at %s" %
+ logger.info("scheduled '%s' job on queue %s for execution at %s" %
(klass_as_string, queue, datetime))
if args:
- logging.debug("job arguments are: %s" % str(args))
+ logger.debug("job arguments are: %s" % str(args))
payload = {'class': klass_as_string, 'queue': queue, 'args': args}
if 'first_attempt' in kwargs:
payload['first_attempt'] = kwargs['first_attempt']

No commit comments for this range

Something went wrong with that request. Please try again.