| 
									
										
										
										
											2021-06-19 23:41:19 +08:00
										 |  |  | // ignore: import_of_legacy_library_into_null_safe
 | 
					
						
							|  |  |  | import 'package:logger/logger.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Log { | 
					
						
							|  |  |  |   static final shared = Log(); | 
					
						
							|  |  |  |   late Logger _logger; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Log() { | 
					
						
							|  |  |  |     _logger = Logger( | 
					
						
							|  |  |  |       printer: PrettyPrinter( | 
					
						
							| 
									
										
										
										
											2021-09-11 20:09:46 +08:00
										 |  |  |           methodCount: 2, // number of method calls to be displayed
 | 
					
						
							| 
									
										
										
										
											2022-02-20 08:35:52 +08:00
										 |  |  |           errorMethodCount: 8, // number of method calls if stacktrace is provided
 | 
					
						
							| 
									
										
										
										
											2021-06-19 23:41:19 +08:00
										 |  |  |           lineLength: 120, // width of the output
 | 
					
						
							|  |  |  |           colors: true, // Colorful log messages
 | 
					
						
							|  |  |  |           printEmojis: true, // Print an emoji for each log message
 | 
					
						
							| 
									
										
										
										
											2021-09-12 23:04:34 +08:00
										 |  |  |           printTime: false // Should each log print contain a timestamp
 | 
					
						
							| 
									
										
										
										
											2021-06-19 23:41:19 +08:00
										 |  |  |           ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   static void info(dynamic msg) { | 
					
						
							|  |  |  |     Log.shared._logger.i(msg); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   static void debug(dynamic msg) { | 
					
						
							|  |  |  |     Log.shared._logger.d(msg); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-20 08:35:52 +08:00
										 |  |  |   static void warn(dynamic msg) { | 
					
						
							|  |  |  |     Log.shared._logger.w(msg); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-12 23:04:34 +08:00
										 |  |  |   static void trace(dynamic msg) { | 
					
						
							|  |  |  |     Log.shared._logger.d(msg); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-19 23:41:19 +08:00
										 |  |  |   static void error(dynamic msg) { | 
					
						
							|  |  |  |     Log.shared._logger.e(msg); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |