@@ -10,19 +10,23 @@ def __init__(self, pasts):
1010
1111def main ():
1212 file_path = "maze/maze.png"
13- log_file_path = "maze/log/result.txt"
14- handler = logging .handlers .RotatingFileHandler (log_file_path , maxBytes = 1024 * 1024 , backupCount = 10000 )
13+ logger = set_logger ()
14+ points_pixels , width , height = first_step (file_path )
15+ # second_step(points_pixels, height)
16+ start = (639 , 0 )
17+ # third_step(start, points_pixels, logger)
18+
19+
20+ def set_logger ():
21+ log_file_path = "maze/log/mylog.log"
22+ handler = logging .handlers .RotatingFileHandler (log_file_path , maxBytes = 1024 * 1024 , backupCount = 10000 )
1523 fmt = "%(asctime)s=>%(message)s"
1624 formatter = logging .Formatter (fmt )
1725 handler .setFormatter (formatter )
1826 logger = logging .getLogger ("maze/log/mylog" )
1927 logger .addHandler (handler )
2028 logger .setLevel (logging .DEBUG )
21-
22- points_pixels , width , height = first_step (file_path )
23- # second_step(points_pixels, height)
24- start = (639 , 0 )
25- third_step (start , points_pixels , logger )
29+ return logger
2630
2731
2832def first_step (file_path ):
@@ -114,16 +118,12 @@ def find_next_point(points_pixels, x, y, past, logger):
114118 up_point = x , up_y
115119 down_point = x , down_y
116120 if right_x_pixel is not None and right_x_pixel != (255 , 255 , 255 , 255 ):
117- # logger.info("right_x={}, y={}, right_x_pixel={}".format(right_x, y, right_x_pixel))
118121 points .append (right_point )
119122 if left_x_pixel is not None and left_x_pixel != (255 , 255 , 255 , 255 ):
120- # logger.info("left_x={}, y={}, left_x_pixel={}".format(left_x, y, left_x_pixel))
121123 points .append (left_point )
122124 if up_y_pixel is not None and up_y_pixel != (255 , 255 , 255 , 255 ):
123- # logger.info("x={}, up_y={}, up_y_pixel={}".format(x, up_y, up_y_pixel))
124125 points .append (up_point )
125126 if down_y_pixel is not None and down_y_pixel != (255 , 255 , 255 , 255 ):
126- # logger.info("x={}, down_y={}, down_y_pixel={}".format(x, down_y, down_y_pixel))
127127 points .append (down_point )
128128 for point in points :
129129 now_index = past .index ((x , y ))
0 commit comments