// // Created by Adarion on 2024/2/18. // #include "Logger.h" #include #include namespace Mika { void Logger::logInfo(const std::string &message) { std::cout << getTimestamp() << " [INFO] " << message << std::endl; } void Logger::logError(const std::string &message) { std::cerr << getTimestamp() << " [ERROR] " << message << std::endl; } void Logger::logWarning(const std::string &message) { std::cerr << getTimestamp() << " [WARNING] " << message << std::endl; } void Logger::logDebug(const std::string &message) { #if defined(__DEVELOPMENT__) || defined(__DEBUG__) std::cout << getTimestamp() << " [DEBUG] " << message << std::endl; #endif } void Logger::logTrace(const std::string &message) { #if defined(__DEVELOPMENT__) || defined(__DEBUG__) std::cout << getTimestamp() << " [TRACE] " << message << std::endl; #endif } std::string Logger::getTimestamp() { auto now = std::chrono::system_clock::now(); auto in_time_t = std::chrono::system_clock::to_time_t(now); std::string time = std::ctime(&in_time_t); time.pop_back(); return time; } } // Mika