Conn2Flow
Docs navigation

Reference / Libraries

log.php library

log_disco() for daily files in gestor/logs/, log_backtrace() for diagnostics and the legacy functions that write to the historico table.

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() and log_hosts_usuarios() belong to the multi-host mode: they require id_hosts, read the record version from the given table (with id unescaped in the SQL) and have no callers.

Functions

Generated from gestor/bibliotecas/log.php · 6 functions

6 of 6

log_debugar

view source · line 60 ↗
log_debugar(array|false $params = false): void

Registra alterações para debug no histórico.

Parameters

$paramsarray|false
Parâmetros da função.

Returns

void

log_usuarios

view source · line 202 ↗
log_usuarios(array|false $params = false): void

Registra log de alterações realizadas por usuários do sistema.

Parameters

$paramsarray|false
Parâmetros da função.

Returns

void

log_backtrace

view source · line 348 ↗
log_backtrace(string $titulo = 'Encadeamento de chamada:', string $logFilename = 'gestor', bool $deleteFileAfter = false, array $contexto = Array()): string

Registra 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

string
Rastreamento de chamadas em formato de texto.

log_disco

view source · line 408 ↗
log_disco(string $msg, string $logFilename = "gestor", bool $deleteFileAfter = false): void

Grava 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

void

The Future is Hybrid: Human + AI.

Conn2Flow is the tool. If you need the Architect to design your company's strategy using this technology...

Hire Specialized Consulting