调整以适应esp32
This commit is contained in:
		
							
								
								
									
										23
									
								
								app/logs/logger.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								app/logs/logger.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| #!/usr/bin/env python | ||||
| # -*- coding: utf-8 -*- | ||||
|  | ||||
| """ | ||||
| 一个简单的、可配置的日志记录器模块。 | ||||
| """ | ||||
|  | ||||
| from app.config.config import * | ||||
|  | ||||
|  | ||||
| def log(message: str): | ||||
|     """ | ||||
|     打印一条日志消息,是否实际输出取决于配置文件。 | ||||
|  | ||||
|     Args: | ||||
|         message (str): 要打印的日志消息。 | ||||
|     """ | ||||
|     # 从配置文件中获取调试开关的状态 | ||||
|     # .get()方法可以安全地获取值,如果键不存在,则返回默认值False | ||||
|     if SYSTEM_PARAMS.get('debug_enabled', False): | ||||
|         print(message) | ||||
|  | ||||
|     # 如果开关为False,此函数会立即返回,不执行任何操作。 | ||||
		Reference in New Issue
	
	Block a user