This file contains hidden or 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
vinay@zeta-lucid:~/projects/scratch$ python satest.py | |
Engine id/echo settings: | |
ID: 0x8698d0c echo: False | |
ID: 0x869c0cc echo: True | |
ID: 0x869c42c echo: debug | |
sqlalchemy.engine.base.Engine INFO 0x869c0cc INSERT INTO items2 DEFAULT VALUES | |
sqlalchemy.engine.base.Engine INFO 0x869c0cc () | |
sqlalchemy.engine.base.Engine INFO 0x869c0cc COMMIT | |
sqlalchemy.engine.base.Engine INFO 0x869c42c INSERT INTO items3 DEFAULT VALUES | |
sqlalchemy.engine.base.Engine INFO 0x869c42c () |
This file contains hidden or 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
import logging | |
class QueueHandler(logging.Handler): | |
""" | |
This handler sends events to a queue. Typically, it would be used together | |
with a multiprocessing Queue to centralise logging to file in one process | |
(in a multi-process application), so as to avoid file write contention | |
between processes. | |
This code is new in Python 3.2, but this class can be copy pasted into |
This file contains hidden or 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
import logging | |
try: | |
import Queue as queue | |
except ImportError: | |
import queue | |
import threading | |
class QueueHandler(logging.Handler): | |
""" | |
This handler sends events to a queue. Typically, it would be used together |
This file contains hidden or 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
vinay@zeta-lucid:~/tools/sqlalchemy$ diff /tmp/test1 /tmp/test2 | |
2633c2633 | |
< AssertionError: 'SELECT users.id AS users_id, users.name AS users_name FROM users' != 'SELECT users.id AS users_id, users.name AS users_name FROM users USE INDEX (col1_index,col2_index)' on dialect <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb object at 0xb0e3f0c> | |
--- | |
> AssertionError: 'SELECT users.id AS users_id, users.name AS users_name FROM users' != 'SELECT users.id AS users_id, users.name AS users_name FROM users USE INDEX (col1_index,col2_index)' on dialect <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb object at 0xbee3acc> | |
2643c2643 | |
< Ran 2433 tests in 97.937s | |
--- | |
> Ran 2433 tests in 117.417s |
This file contains hidden or 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
#!/usr/bin/env python | |
# Copyright (C) 2010 Vinay Sajip. All Rights Reserved. | |
# | |
# Permission to use, copy, modify, and distribute this software and its | |
# documentation for any purpose and without fee is hereby granted, | |
# provided that the above copyright notice appear in all copies and that | |
# both that copyright notice and this permission notice appear in | |
# supporting documentation, and that the name of Vinay Sajip | |
# not be used in advertising or publicity pertaining to distribution | |
# of the software without specific, written prior permission. |
This file contains hidden or 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
vinay@eta-jaunty:~/projects/scratch$ python3.2 timefc.py | |
filename_comparison 50.61 microseconds | |
module_globals 49.56 microseconds | |
vinay@eta-jaunty:~/projects/scratch$ python2.7 timefc.py | |
filename_comparison 50.79 microseconds | |
module_globals 50.01 microseconds |
This file contains hidden or 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
vinay@eta-jaunty:~/projects/python/branches/py3k/Lib/test$ python3.2 regrtest.py -v test_traceback | |
== CPython 3.2a2+ (py3k:85322:85340M, Oct 9 2010, 12:36:43) [GCC 4.3.3] | |
== Linux-2.6.28-19-generic-i686-with-debian-5.0 little-endian | |
== /home/vinay/projects/python/branches/py3k/Lib/test/build/test_python_21548 | |
[1/1] test_traceback | |
test_cause (test.test_traceback.CExcReportingTests) ... ok | |
test_cause_and_context (test.test_traceback.CExcReportingTests) ... ok | |
test_cause_recursive (test.test_traceback.CExcReportingTests) ... ok | |
test_context (test.test_traceback.CExcReportingTests) ... ok | |
test_simple (test.test_traceback.CExcReportingTests) ... ok |
This file contains hidden or 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
Some thoughts about Celery and logging | |
====================================== | |
LoggerAdapter | |
------------- | |
It appears that the use of LoggerAdapter is to get the processName into the | |
LogRecord (at least, that's what _CompatLoggerAdapter does) but if | |
LoggerAdapter is defined in logging, _CompatLoggerAdapter won't be used. |
This file contains hidden or 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
# | |
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license. | |
# | |
import ctypes | |
import logging | |
import os | |
class ColorizingStreamHandler(logging.StreamHandler): | |
# color names to indices | |
color_map = { |
This file contains hidden or 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
# Copyright (C) 2011 Vinay Sajip. All rights reserved. | |
import PySide | |
import PySide.QtCore as QtCore | |
import PySide.QtGui as QtGui | |
Qt = QtCore.Qt | |
import bisect | |
import logging |