#pragma once #if !defined(DUSK_BUILDING_GAME) && !defined(DUSK_MOD_FEATURE_FMT) #error "mods/svc/log.hpp requires add_mod(... FEATURES fmt)" #endif #include #include #include namespace mods::log { template void write(LogLevel level, fmt::format_string formatString, Args&&... args) { const auto message = fmt::format(formatString, std::forward(args)...); svc_log->write(mod_ctx, level, message.c_str()); } template void trace(fmt::format_string formatString, Args&&... args) { write(LOG_LEVEL_TRACE, formatString, std::forward(args)...); } template void debug(fmt::format_string formatString, Args&&... args) { write(LOG_LEVEL_DEBUG, formatString, std::forward(args)...); } template void info(fmt::format_string formatString, Args&&... args) { write(LOG_LEVEL_INFO, formatString, std::forward(args)...); } template void warn(fmt::format_string formatString, Args&&... args) { write(LOG_LEVEL_WARN, formatString, std::forward(args)...); } template void error(fmt::format_string formatString, Args&&... args) { write(LOG_LEVEL_ERROR, formatString, std::forward(args)...); } } // namespace mods::log