Worker : log toutes les lignes stdout de pagedjs-cli pour diagnostic
All checks were successful
Deploy / deploy (push) Successful in 18s
All checks were successful
Deploy / deploy (push) Successful in 18s
Aide à comprendre si pagedjs-cli batch sa sortie en non-TTY (ora désactivé) ou si la progression page par page est juste trop rapide pour le polling. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0b954ed494
commit
db74e27c3a
1 changed files with 8 additions and 1 deletions
|
|
@ -51,7 +51,14 @@ $generator = new \Web2Print\Services\PdfGenerator($config);
|
||||||
$pdfPath = $jobs->pdfPath($jobId);
|
$pdfPath = $jobs->pdfPath($jobId);
|
||||||
|
|
||||||
$pageCount = 0;
|
$pageCount = 0;
|
||||||
$onProgress = function (string $line) use ($jobs, $jobId, &$pageCount) {
|
$debugLog = $config['log_file'];
|
||||||
|
$logLine = function (string $msg) use ($debugLog, $jobId) {
|
||||||
|
@file_put_contents($debugLog, '[' . date('Y-m-d H:i:s.u') . '] [job ' . $jobId . '] ' . $msg . "\n", FILE_APPEND);
|
||||||
|
};
|
||||||
|
$logLine('worker start, url=' . ($request['url'] ?? '?'));
|
||||||
|
|
||||||
|
$onProgress = function (string $line) use ($jobs, $jobId, &$pageCount, $logLine) {
|
||||||
|
$logLine('stdout: ' . $line);
|
||||||
// pagedjs-cli utilise ora qui peut émettre via \r ; on a déjà découpé.
|
// pagedjs-cli utilise ora qui peut émettre via \r ; on a déjà découpé.
|
||||||
// Lignes typiques : "- Loading: ...", "✔ Loaded", "- Rendering: Page X"
|
// Lignes typiques : "- Loading: ...", "✔ Loaded", "- Rendering: Page X"
|
||||||
if (preg_match('/Rendering:\s*Page\s*(\d+)/i', $line, $m)) {
|
if (preg_match('/Rendering:\s*Page\s*(\d+)/i', $line, $m)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue