#ifndef LOGGER_H
#define LOGGER_H

#include "utils/StringBuffer.h"

namespace Logger {
    enum Level { NONE, ERROR, WARNING, INFO, DEBUG };

    extern Level level;

    template<int N>
    void error(const StringBuffer<N>& s) {
#if LOG_LEVEL >= 1
        if(level >= ERROR) {
            std::cout << "\33[1;31m[ERROR] " << s << "\33[39;49m\n";
        }
#else
        (void)s;
#endif
    }

    template<int N>
    void warn(const StringBuffer<N>& s) {
#if LOG_LEVEL >= 2
        if(level >= WARNING) {
            std::cout << "\33[1;33m[WARNING] " << s << "\33[39;49m\n";
        }
#else
        (void)s;
#endif
    }

    template<int N>
    void info(const StringBuffer<N>& s) {
#if LOG_LEVEL >= 3
        if(level >= INFO) {
            std::cout << "\33[1;37m[INFO] " << s << "\33[39;49m\n";
        }
#else
        (void)s;
#endif
    }

    template<int N>
    void debug(const StringBuffer<N>& s) {
#if LOG_LEVEL >= 4
        if(level >= DEBUG) {
            std::cout << "\33[1;32m[DEBUG] " << s << "\33[39;49m\n";
        }
#else
        (void)s;
#endif
    }
}

#endif