Add autostart_log param

pull/408/head
FlightlessMango 3 years ago
parent ee2933bff5
commit 3827fe96d4

@ -145,7 +145,8 @@ background_alpha=0.5
#upload_log=Shift+F3
################## LOG #################
### Automatically start the log after X seconds
# autostart_log = 1
### Set amount of time in second that the logging will run for
# log_duration
### Define name and location of the output file (Required for logging)

@ -165,4 +165,9 @@ void Logger::upload_last_log() {
void Logger::upload_last_logs() {
if(m_log_files.empty()) return;
std::thread(upload_files, m_log_files).detach();
}
void autostart_log(int sleep) {
os_time_sleep(sleep * 1000000);
logger->start_logging();
}

@ -74,5 +74,6 @@ extern uint64_t frametime;
extern logData currentLogData;
string exec(string command);
void autostart_log(int sleep);
#endif //MANGOHUD_LOGGING_H

@ -70,7 +70,6 @@ void update_hw_info(struct swapchain_stats& sw_stats, struct overlay_params& par
}
void update_hud_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID){
if(not logger) logger = std::make_unique<Logger>(&params);
uint32_t f_idx = sw_stats.n_frames % ARRAY_SIZE(sw_stats.frames_stats);
uint64_t now = os_time_get(); /* us */
double elapsed = (double)(now - sw_stats.last_fps_update); /* us */

@ -22,7 +22,6 @@
#include "config.h"
#include "string_utils.h"
#include "hud_elements.h"
#include "mesa/util/os_socket.h"
#ifdef HAVE_X11
@ -380,6 +379,7 @@ parse_font_glyph_ranges(const char *str)
#define parse_no_small_font(s) parse_unsigned(s) != 0
#define parse_cellpadding_y(s) parse_float(s)
#define parse_table_columns(s) parse_unsigned(s)
#define parse_autostart_log(s) parse_unsigned(s)
#define parse_cpu_color(s) parse_color(s)
#define parse_gpu_color(s) parse_color(s)
@ -736,4 +736,8 @@ parse_overlay_config(struct overlay_params *params,
// Needs ImGui context but it is null here for OpenGL so just note it and update somewhere else
HUDElements.colors.update = true;
if(not logger) logger = std::make_unique<Logger>(params);
if(params->autostart_log)
std::thread(autostart_log, params->autostart_log).detach();
}

@ -118,6 +118,7 @@ typedef unsigned long KeySym;
OVERLAY_PARAM_CUSTOM(cellpadding_y) \
OVERLAY_PARAM_CUSTOM(table_columns) \
OVERLAY_PARAM_CUSTOM(blacklist) \
OVERLAY_PARAM_CUSTOM(autostart_log) \
enum overlay_param_position {
LAYER_POSITION_TOP_LEFT,
@ -200,7 +201,7 @@ struct overlay_params {
std::string cpu_text, gpu_text;
//std::string blacklist;
std::vector<std::string> blacklist;
unsigned log_interval;
unsigned log_interval, autostart_log;
std::vector<media_player_order> media_player_order;
std::vector<std::string> benchmark_percentiles;
std::string font_file, font_file_text;

Loading…
Cancel
Save