Skip to content

Commit 2d21b86

Browse files
committed
branching for 0.3.0
1 parent ddf73a5 commit 2d21b86

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from distutils.core import setup
66

77
setup(name = "ws4py",
8-
version = '0.2.5',
8+
version = '0.3.0',
99
description = "WebSocket library for Python",
1010
maintainer = "Sylvain Hellegouarch",
1111
maintainer_email = "sh@defuze.org",

ws4py/__init__.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,32 @@
2626
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2727
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
#
29+
import logging
2930
from ws4py.compat import enc
3031

3132
__author__ = "Sylvain Hellegouarch"
32-
__version__ = "0.2.5"
33-
__all__ = ['WS_KEY', 'WS_VERSION']
33+
__version__ = "0.3.0"
34+
__all__ = ['WS_KEY', 'WS_VERSION', 'configure_logger']
3435

3536
WS_KEY = enc("258EAFA5-E914-47DA-95CA-C5AB0DC85B11")
3637
WS_VERSION = (8, 13)
3738

39+
def configure_logger(stdout=True, filepath=None, level=logging.INFO):
40+
logger = logging.getLogger('ws4py')
41+
logger.setLevel(level)
42+
logfmt = logging.Formatter("[%(asctime)s] %(levelname)s %(message)s")
43+
44+
if filepath:
45+
h = handlers.RotatingFileHandler(filepath, maxBytes=10485760, backupCount=3)
46+
h.setLevel(level)
47+
h.setFormatter(logfmt)
48+
logger.addHandler(h)
49+
50+
if stdout:
51+
import sys
52+
h = logging.StreamHandler(sys.stdout)
53+
h.setLevel(level)
54+
h.setFormatter(logfmt)
55+
logger.addHandler(h)
56+
57+
return logger

0 commit comments

Comments
 (0)