Enhance account tracing functionality and error handling in inc_fx_trace_compte.php

This commit updates the account tracing logic by adding a check for both development and pre-production environments to determine if tracing is enabled. Additionally, it introduces a fallback error logging mechanism to capture log entries when the log file is not writable, improving the robustness of the tracing functionality. These changes aim to enhance debugging capabilities and ensure reliable logging in various environments.
This commit is contained in:
2026-07-07 13:28:10 -04:00
parent 316583d108
commit eeb08bc563

View File

@ -13,9 +13,9 @@ function fxTraceCompteEnabled()
return $blnEnabled;
}
global $vblnEnvironementDev;
global $vblnEnvironementDev, $vblnEnvironementPreProd;
if (empty($vblnEnvironementDev)) {
if (empty($vblnEnvironementDev) && empty($vblnEnvironementPreProd)) {
$blnEnabled = false;
return false;
}
@ -57,6 +57,11 @@ function fxTraceCompte($strStep, $arrExtra = array())
}
@file_put_contents($strDir . '/compte-trace.log', $strLine, FILE_APPEND | LOCK_EX);
// Secours si le dossier logs n'est pas inscriptible (permissions serveur).
if (!is_file($strDir . '/compte-trace.log')) {
@error_log('compte-trace: ' . trim($strLine));
}
}
/** Appeler juste avant header('Location:…'); exit; */