@@ -0,0 +1,1382 @@
+from __future__ import with_statement %0Aimport glob%0Aimport logging%0Aimport logging.handlers%0Aimport sys%0A#http://pymotw.com/2/logging/%0A#https://docs.python.org/2/howto/logging-cookbook.html%0A%0A#username=''%0A#LOG_PATH = '/home/'+username+'/logs/'%0ALOG_PATH = '/var/log/'%0A%0Allevel=logging.DEBUG%0A%0A#create logger%0Adef create(logname):%0A%09global llevel%0A%09LOG_FILENAME= LOG_PATH + logname #+ '.out'%0A%09logging.basicConfig(filename=LOG_FILENAME,%0A%09%09%09%09%09%09level=llevel,%0A%09%09%09%09%09%09format='%25(asctime)s %25(name)-12s %25(levelname)-8s %25(message)s',%0A%09%09%09%09%09%09datefmt='%25m-%25d %25H:%25M:%25S'%0A%09%09%09%09%09%09)%0A%0A%0A%0Adef dunno():%09%09%09%09%09%0A%09f = open(LOG_FILENAME, 'rt')%0A%09try:%0A%09%09body = f.read()%0A%09finally:%0A%09%09f.close()%0A%0A%09print('FILE:')%0A%09print(body)%0A%0A%0ALEVELS = %7B 'debug':logging.DEBUG,%0A            'info':logging.INFO,%0A            'warning':logging.WARNING,%0A            'error':logging.ERROR,%0A            'critical':logging.CRITICAL,%0A            %7D%0A%0Aif len(sys.argv) %3E 1:%0A    level_name = sys.argv%5B1%5D%0A    level = LEVELS.get(level_name, logging.NOTSET)%0A    logging.basicConfig(level=level)%0A%0Adef testlog():%09%0A%09logging.debug('This is a debug message')%0A%09logging.info('This is an info message')%0A%09logging.warning('This is a warning message')%0A%09logging.error('This is an error message')%0A%09logging.critical('This is a critical error message')%0A%09%0A%0A%0Adef verbose(var):%0A    global llevel%0A    if var:%0A        llevel=logging.DEBUG%0A    else :%0A        llevel=logging.WARNING%0A

Create log.py