mirror of
				https://github.com/chibicitiberiu/ytsm.git
				synced 2024-02-24 05:43:31 +00:00 
			
		
		
		
	Fixed issues with log not working.
This commit is contained in:
		@@ -118,6 +118,7 @@ MEDIA_URL = '/media/'
 | 
			
		||||
CRISPY_TEMPLATE_PACK = 'bootstrap4'
 | 
			
		||||
 | 
			
		||||
LOG_FORMAT = '%(asctime)s|%(process)d|%(thread)d|%(name)s|%(filename)s|%(lineno)d|%(levelname)s|%(message)s'
 | 
			
		||||
CONSOLE_LOG_FORMAT = '%(asctime)s | %(name)s | %(filename)s:%(lineno)d | %(levelname)s | %(message)s'
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Directories
 | 
			
		||||
 
 | 
			
		||||
@@ -22,18 +22,17 @@ def __initialize_logger():
 | 
			
		||||
        maxBytes=1024 * 1024,
 | 
			
		||||
        backupCount=5
 | 
			
		||||
    )
 | 
			
		||||
    handlers.append(file_handler)
 | 
			
		||||
    file_handler.setLevel(dj_settings.LOG_LEVEL)
 | 
			
		||||
    file_handler.setFormatter(logging.Formatter(dj_settings.LOG_FORMAT))
 | 
			
		||||
    logging.root.addHandler(file_handler)
 | 
			
		||||
    logging.root.setLevel(dj_settings.LOG_LEVEL)
 | 
			
		||||
 | 
			
		||||
    if dj_settings.DEBUG:
 | 
			
		||||
        console_handler = logging.StreamHandler(stream=sys.stdout)
 | 
			
		||||
        console_handler.setLevel(logging.DEBUG)
 | 
			
		||||
        handlers.append(console_handler)
 | 
			
		||||
        console_handler.setFormatter(logging.Formatter(dj_settings.CONSOLE_LOG_FORMAT))
 | 
			
		||||
        logging.root.addHandler(console_handler)
 | 
			
		||||
 | 
			
		||||
    logging.basicConfig(
 | 
			
		||||
        level=dj_settings.LOG_LEVEL,
 | 
			
		||||
        format=dj_settings.LOG_FORMAT,
 | 
			
		||||
        handlers=handlers
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user