#pragma once

#include <iostream>
#include <fstream>
#include <string>
#include <ctime>

enum class LogLevel
{
    INFO,
    WARN,
    ERROR
};

class Logger
{
public:
    static void set_log_to_file(const std::string &filename);

    static void log(LogLevel level, const std::string &msg);

private:
    static std::ofstream log_file;
    static std::string get_time_string();
};

// 简化宏
#define LOG_INFO(msg) Logger::log(LogLevel::INFO, msg)
#define LOG_WARN(msg) Logger::log(LogLevel::WARN, msg)
#define LOG_ERROR(msg) Logger::log(LogLevel::ERROR, msg)
