static void WriteLog(std::string const& type, std::string const& msg, Color const& c = Color()) { // Skip logging to file in the browser #ifndef EMSCRIPTEN if (!Main_Data::GetSavePath().empty()) { // Only write to file when project path is initialized // (happens after parsing the command line) for (std::string& log : log_buffer) { output_time() << log << std::endl; } log_buffer.clear(); output_time() << type << ": " << msg << std::endl; } else { // buffer log messages until file system is ready log_buffer.push_back(type + ": " + msg); } #endif #ifdef __ANDROID__ __android_log_print(type == "Error" ? ANDROID_LOG_ERROR : ANDROID_LOG_INFO, "EasyRPG Player", "%s", msg.c_str()); #else std::cerr << type << ": " << msg << std::endl; #endif if (type != "Debug") { if (DisplayUi) { message_overlay().AddMessage(msg, c); } } }
static void WriteLog(std::string const& type, std::string const& msg, Color const& c = Color()) { output_time() << type << ": " << msg << std::endl; #ifdef __ANDROID__ __android_log_print(type == "Error" ? ANDROID_LOG_ERROR : ANDROID_LOG_INFO, "EasyRPG Player", "%s", msg.c_str()); #else std::cerr << type << ": " << msg << std::endl; #endif if (type != "Debug") { if (DisplayUi) { message_overlay().AddMessage(msg, c); } } }
void Output::ToggleLog() { static bool show_log = true; message_overlay().SetShowAll(show_log); show_log = !show_log; }