-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add offset_policy parameter to Worker class and add documentation for…
… logging
- Loading branch information
Showing
7 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ Contents | |
decorator | ||
callback | ||
cli | ||
logging | ||
|
||
|
||
Credits | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Logging | ||
------- | ||
|
||
By default KQ logs messages using the ``kq`` logger. | ||
|
||
Here is an example showing how the logger can be enabled and customized: | ||
|
||
.. code-block:: python | ||
import logging | ||
from kq import Queue | ||
logger = logging.getLogger('kq') | ||
# Set the logging level | ||
logger.setLevel(logging.DEBUG) | ||
# Attach a handler | ||
handler = logging.StreamHandler() | ||
formatter = logging.Formatter('[%(levelname)s] %(message)s') | ||
handler.setFormatter(formatter) | ||
logger.addHandler(handler) | ||
# Enqueue function calls | ||
q = Queue() | ||
q.enqueue(int, 1) | ||
q.enqueue(str, 1) | ||
q.enqueue(bool, 1) | ||
The logging output for above would look something like this: | ||
|
||
.. code-block:: bash | ||
[INFO] Enqueued: Job(id='64ee47d', topic='default', func=<class 'int'> ...) | ||
[INFO] Enqueued: Job(id='4578f57', topic='default', func=<class 'str'> ...) | ||
[INFO] Enqueued: Job(id='792643c', topic='default', func=<class 'bool'> ...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VERSION = '1.2.0' | ||
VERSION = '1.3.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters