logging lib

This commit is contained in:
Drath
2025-10-03 16:57:38 +02:00
parent 31f2c8bf7c
commit 7e7d8d2aa1
12 changed files with 80 additions and 48 deletions

View File

@@ -8,11 +8,11 @@ namespace gpu {
/* takes pointer to a target gpu::sensors struct and updates its hwmon path and detects gpu_metrics */
void detectHwmon(gpuSensors* target, std::string pci) {
target->hwmon = getFirstDir("/sys/bus/pci/devices/" + pci + "/hwmon");
std::println("[gpu::detectHwmon] Detected path \"{}\"", target->hwmon);
log(LOG::INF, "gpu::detectHwmon", "Detected path \"{}\"", target->hwmon);
if (FILE* file = fopen((target->hwmon + REL_METRICS_PATH).c_str(), "r")) {
fclose(file);
std::println("[gpu::detectHwmon] found metrics file");
log(LOG::INF, "gpu::detectHwmon", "found metrics file");
target->hasGpuMetrics = true;
}
}
@@ -80,7 +80,7 @@ void updateFromMetrics(gpuSensors* g) {
/* werid hardware i probably dont like, maybe fallback to reading from fs? */
default: {
std::println("[gpu::updateFromMetrics] Unsupported gpu_metrics_v{}_{}", header->format_revision, header->content_revision);
log(LOG::WRN, "gpu::updateFromMetrics", "Unsupported gpu_metrics_v{}_{}", header->format_revision, header->content_revision);
break;
}
}