Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
1gitclub committed Nov 18, 2015
1 parent 57754de commit ae78af6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-*- coding: utf-8 -*-
RELEASE_TYPE = "py"
RELEASE_TYPE = "release"
GITHUB_HOME = "https://github.com/uname/PySockDebuger"
TCP_SERVER_ENTRY_TEXT = u"TCP Server"
TCP_CLIENT_ENTRY_TEXT = u"TCP Client"
Expand Down Expand Up @@ -46,4 +46,4 @@
STATUS_NOT_CONNECTED = u'<font style="BACKGROUND-COLOR:#C0C0C0">未连接</font>'
STATUS_DISCONNECTED = u'<font style="BACKGROUND-COLOR:#FF0000">已断开</font>'
STATUS_UDP = u'<font style="BACKGROUND-COLOR:#93FF93">UDP-CLIENT</font>'
STATUS_UDP_SERVER = u'<font style="BACKGROUND-COLOR:#93FF93">UDP-SERVER</font>'
STATUS_UDP_SERVER = u'<font style="BACKGROUND-COLOR:#93FF93">UDP-SERVER</font>'
2 changes: 1 addition & 1 deletion genexe.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

setup( zipfile=None,
windows=[{"script":"main.py", "icon_resources":[(1, "resource/icons/app/logo1.ico")]}],
options={"py2exe":{"compressed":2, "bundle_files":3,
options={"py2exe":{"compressed":2, "bundle_files":1,
"includes":["sip", "PyQt4.QtGui", "PyQt4.QtCore"],
"dll_excludes": ["msvcm90.dll", "msvcp90.dll", "msvcr90.dll"] }})
27 changes: 18 additions & 9 deletions log.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,25 @@
import logging
import sys

logger = logging.getLogger("root")
__formatter = logging.Formatter("[%(levelname)-7s][%(asctime)s][%(filename)s:%(lineno)d] %(message)s", "%d %b %Y %H:%M:%S")
logger = None

if config.RELEASE_TYPE == "py":
if config.RELEASE_TYPE != "debug":
class __NullLogger:
def debug(self, msg=""): pass
def warning(self, msg=""): pass
def info(self, msg=""): pass
def error(self, msg=""): pass
def fatal(self, msg=""): pass

logger = __NullLogger()

else:
logger = logging.getLogger("root")
__formatter = logging.Formatter("[%(levelname)-7s][%(asctime)s][%(filename)s:%(lineno)d] %(message)s", "%d %b %Y %H:%M:%S")
__streamHandler = logging.StreamHandler(sys.stdout)
__streamHandler.setFormatter(__formatter)
logger.addHandler(__streamHandler)

__fileHandler = logging.FileHandler("debug.log")
__fileHandler.setFormatter(__formatter)
logger.addHandler(__fileHandler)

logger.setLevel(logging.DEBUG)
__fileHandler = logging.FileHandler("debug.log")
__fileHandler.setFormatter(__formatter)
logger.addHandler(__fileHandler)
logger.setLevel(logging.DEBUG)

0 comments on commit ae78af6

Please sign in to comment.