more straightforward logging
This commit is contained in:
		@@ -15,16 +15,20 @@ OSM_CACHE_DIR = Path(cache_dir_string)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
import yaml
 | 
					# if we are in a debug session, set verbose and rich logging
 | 
				
			||||||
 | 
					 | 
				
			||||||
LOGGING_CONFIG = LOCATION_PREFIX / 'log_config.yaml'
 | 
					 | 
				
			||||||
config = yaml.safe_load(LOGGING_CONFIG.read_text())
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
logging.config.dictConfig(config)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# if we are in a debug session, set the log level to debug
 | 
					 | 
				
			||||||
if os.getenv('DEBUG', False):
 | 
					if os.getenv('DEBUG', False):
 | 
				
			||||||
    logging.getLogger().setLevel(logging.DEBUG)
 | 
					    from rich.logging import RichHandler
 | 
				
			||||||
 | 
					    logging.basicConfig(
 | 
				
			||||||
 | 
					        level=logging.DEBUG,
 | 
				
			||||||
 | 
					        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
 | 
				
			||||||
 | 
					        handlers=[RichHandler()]
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					else:
 | 
				
			||||||
 | 
					    logging.basicConfig(
 | 
				
			||||||
 | 
					        level=logging.INFO,
 | 
				
			||||||
 | 
					        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MEMCACHED_HOST_PATH = os.getenv('MEMCACHED_HOST_PATH', None)
 | 
					MEMCACHED_HOST_PATH = os.getenv('MEMCACHED_HOST_PATH', None)
 | 
				
			||||||
if MEMCACHED_HOST_PATH == "none":
 | 
					if MEMCACHED_HOST_PATH == "none":
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,35 +0,0 @@
 | 
				
			|||||||
version: 1
 | 
					 | 
				
			||||||
disable_existing_loggers: False
 | 
					 | 
				
			||||||
formatters:
 | 
					 | 
				
			||||||
  simple:
 | 
					 | 
				
			||||||
    format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
 | 
					 | 
				
			||||||
handlers:
 | 
					 | 
				
			||||||
  console:
 | 
					 | 
				
			||||||
    class: rich.logging.RichHandler
 | 
					 | 
				
			||||||
    formatter: simple
 | 
					 | 
				
			||||||
    width: 255
 | 
					 | 
				
			||||||
  # access:
 | 
					 | 
				
			||||||
  #   class: logging.FileHandler
 | 
					 | 
				
			||||||
  #   filename: logs/access.log
 | 
					 | 
				
			||||||
  #   level: INFO
 | 
					 | 
				
			||||||
  #   formatter: simple
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
loggers:
 | 
					 | 
				
			||||||
  uvicorn.error:
 | 
					 | 
				
			||||||
    level: INFO
 | 
					 | 
				
			||||||
    handlers:
 | 
					 | 
				
			||||||
      - console
 | 
					 | 
				
			||||||
    propagate: no
 | 
					 | 
				
			||||||
  # uvicorn.access:
 | 
					 | 
				
			||||||
  #   level: INFO
 | 
					 | 
				
			||||||
  #   handlers:
 | 
					 | 
				
			||||||
  #     - access
 | 
					 | 
				
			||||||
  #   propagate: no
 | 
					 | 
				
			||||||
root:
 | 
					 | 
				
			||||||
  level: INFO
 | 
					 | 
				
			||||||
  handlers:
 | 
					 | 
				
			||||||
    - console
 | 
					 | 
				
			||||||
  propagate: yes
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user