package com.yfd.platform.utils;

import lombok.extern.slf4j.Slf4j;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

@Slf4j
public class LogFileReader {

    public static void readLogFile(String filePath) {
        try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
            String line;
            boolean a = false;
            int i = 0;
            while ((line = reader.readLine()) != null) {
                if (line.contains("任务名称") && line.contains("2024-07-17 23:00:00")) {
                    a = true;

                }
                if (a) {
                    if (line.contains("开始调用摄像头预置位")) {
                        i++;
                    }
                    // 在这里可以对每一行进行处理
                    log.info(line);
                }

            }
            log.info("=============="+i);
        } catch (IOException e) {
            log.error(e.getMessage());;
        }
    }


}
