Additional logging + FFMpeg changes; ffmpeg output will be in the log now
This commit is contained in:
27
src/log.cpp
27
src/log.cpp
@@ -2,7 +2,12 @@
|
||||
|
||||
inline std::ofstream logFile;
|
||||
|
||||
static void _log_write(const std::string& string)
|
||||
std::string log_path_get(void)
|
||||
{
|
||||
return preferences_path_get() + LOG_PATH;
|
||||
}
|
||||
|
||||
void log_write(const std::string& string)
|
||||
{
|
||||
std::println("{}", string);
|
||||
|
||||
@@ -13,30 +18,36 @@ static void _log_write(const std::string& string)
|
||||
}
|
||||
}
|
||||
|
||||
void log_init(const std::string& file)
|
||||
void log_init(void)
|
||||
{
|
||||
logFile.open(file, std::ios::out | std::ios::trunc);
|
||||
if (!logFile) std::println("{}", std::format(LOG_INIT_ERROR, file));
|
||||
std::string logFilepath = log_path_get();
|
||||
logFile.open(logFilepath, std::ios::out | std::ios::trunc);
|
||||
if (!logFile) std::println("{}", std::format(LOG_INIT_ERROR, logFilepath));
|
||||
}
|
||||
|
||||
void log_error(const std::string& error)
|
||||
{
|
||||
_log_write(LOG_ERROR_FORMAT + error);
|
||||
log_write(LOG_ERROR_FORMAT + error);
|
||||
}
|
||||
|
||||
void log_info(const std::string& info)
|
||||
{
|
||||
_log_write(LOG_INFO_FORMAT + info);
|
||||
log_write(LOG_INFO_FORMAT + info);
|
||||
}
|
||||
|
||||
void log_warning(const std::string& warning)
|
||||
{
|
||||
_log_write(LOG_WARNING_FORMAT + warning);
|
||||
log_write(LOG_WARNING_FORMAT + warning);
|
||||
}
|
||||
|
||||
void log_imgui(const std::string& imgui)
|
||||
{
|
||||
_log_write(LOG_IMGUI_FORMAT + imgui);
|
||||
log_write(LOG_IMGUI_FORMAT + imgui);
|
||||
}
|
||||
|
||||
void log_command(const std::string& command)
|
||||
{
|
||||
log_write(LOG_COMMAND_FORMAT + command);
|
||||
}
|
||||
|
||||
void log_free(void)
|
||||
|
||||
Reference in New Issue
Block a user