pretty job string function for lish, fixed logging

TODO: set Logging levels
This commit is contained in:
Rafael.Timmerberg 2013-10-10 21:46:29 +02:00
commit 0a8dd894ab
4 changed files with 22 additions and 6 deletions

View file

@ -62,13 +62,14 @@ def parseArgs():
return parser.parse_args()
def setupLogging(logfile="./log/linspector.log", logLevel=logging.DEBUG, logfileLevel=logging.DEBUG):
def setupLogging(logfile="./log/linspector.log", logLevel=logging.ERROR, logfileLevel=logging.DEBUG):
logfile = path.expanduser(logfile)
if not path.exists(path.dirname(logfile)):
os.makedirs(path.dirname(logfile))
logging.basicConfig(level=logging.CRITICAL)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
#log.setLevel(logging.)
consoleHandler = logging.StreamHandler()
consoleHandler.setLevel(logLevel)
@ -76,6 +77,7 @@ def setupLogging(logfile="./log/linspector.log", logLevel=logging.DEBUG, logfile
fileHandler = logging.handlers.RotatingFileHandler(logfile, maxBytes=1024000, backupCount=4)
fileHandler.setLevel(logfileLevel)
consoleFormatter = logging.Formatter('[%(levelname)s]: %(message)s')
#TODO: if debug with file and function else without that
fileFormatter = logging.Formatter('%(asctime)s %(pathname)s %(module)s %(funcName)s %(lineno)d [%(levelname)s]: %(message)s')