19 lines
472 B
PHP
19 lines
472 B
PHP
<?php
|
|
// TEMPORARY
|
|
/** Appends one timestamped line. Silent if the file cannot be written. */
|
|
function debug_log(string $message): void
|
|
{
|
|
$path = dirname(__DIR__, 3) . '/storage/logs/casadoc-api.log';
|
|
|
|
$dir = dirname($path);
|
|
if (!is_dir($dir) && !@mkdir($dir, 0775, true) && !is_dir($dir)) {
|
|
return;
|
|
}
|
|
|
|
@file_put_contents(
|
|
$path,
|
|
'[' . date('Y-m-d H:i:s') . '] ' . rtrim($message) . "\n",
|
|
FILE_APPEND | LOCK_EX
|
|
);
|
|
}
|