Path in the Gestor bibliotecas/log.php
Two different things under the same prefix: file logs (log_disco, log_backtrace) and database history (log_debugar and three legacy functions). Registered as log; command-line scripts include it directly.
When included, it ensures $_GESTOR['debug'] (default false) and $_GESTOR['logs-path'] (default gestor/logs/, created if missing).
File log
log_disco('Import finished: 42 records', 'import');
// gestor/logs/import-2026-09-26.log
// [2026-09-26 14:03:11] Import finished: 42 records-
log_disco($msg, $file = 'gestor', $deleteBefore = false)appends the line with date and time to<logs-path><file>-<YYYY-MM-DD>.log. With$deleteBefore, it restarts the day's file. -
With
$_GESTOR['debug']on, it prints the message instead of writing it (useful on the CLI; in a web request, it lands in the middle of the HTML). -
log_backtrace($title, $file, $deleteBefore, $context)writes the current call stack with the request metadata (method, path, module, option, language and only the names of the GET/POST fields, never their values) and returns the stack. It is the tool to find out what triggered an unexpected alert or redirect.
Other files in gestor/logs/: hooks-errors.log (hooks), cron-<dd-mm-yyyy>.log (cron) and the atualizacoes/ and plugins/ subfolders of the update scripts.
Database history (historico)
The historico table records who changed what. The normal way to write it is through interface.php, which records the changes of CRUD forms. In this library:
-
log_debugar(['alteracoes' => [[ 'modulo' => …, 'id' => …, 'alteracao' => …, 'alteracao_txt' => … ]]])writes one row per change with the current user and the date. A single caller in the core. -
log_controladores(),log_usuarios()andlog_hosts_usuarios()belong to the multi-host mode: they requireid_hosts, read the record version from the given table (withidunescaped in the SQL) and have no callers.
Functions
Generated from gestor/bibliotecas/log.php · 6 functions
log_debugar
view source · line 60 ↗log_debugar(array|false $params = false): voidRegistra alterações para debug no histórico.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
log_controladores
view source · line 123 ↗log_controladores(array|false $params = false): voidRegistra log de alterações realizadas por controladores.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
log_usuarios
view source · line 202 ↗log_usuarios(array|false $params = false): voidRegistra log de alterações realizadas por usuários do sistema.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
log_hosts_usuarios
view source · line 281 ↗log_hosts_usuarios(array|false $params = false): voidRegistra log de alterações realizadas por usuários de hosts.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
log_backtrace
view source · line 348 ↗log_backtrace(string $titulo = 'Encadeamento de chamada:', string $logFilename = 'gestor', bool $deleteFileAfter = false, array $contexto = Array()): stringRegistra o encadeamento de chamadas atual em arquivo de log.
Parameters
$titulostring- Texto que antecede o rastreamento.
$logFilenamestring- Nome base do arquivo de log sem extensão.
$deleteFileAfterbool- Se true, exclui o arquivo antes de gravar.
$contextoarray- Metadados adicionais seguros para incluir no log.
Returns
log_disco
view source · line 408 ↗log_disco(string $msg, string $logFilename = "gestor", bool $deleteFileAfter = false): voidGrava mensagens de log em arquivo de disco.
Parameters
$msgstring- Mensagem a ser gravada no log (obrigatório).
$logFilenamestring- Nome base do arquivo de log sem extensão (padrão: "gestor").
$deleteFileAfterbool- Se true, exclui o arquivo antes de gravar (padrão: false).
Returns