import java.io.FileWriter;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class EventLogger {
    public static void logToFile(String path, String message) {
        try (FileWriter fw = new FileWriter(path, true)) {
            fw.write(message + System.lineSeparator());
        } catch (IOException e) {
            System.err.println("Failed to write event to file: " + e.getMessage());
        }
    }

    public static String getTimestamp() {
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }
}
