SmartCane/laravel_app/app/ProjectLogger.php
2024-08-30 16:16:26 +02:00

17 lines
447 B
PHP

<?php
namespace App;
use App\Models\Project;
use Illuminate\Support\Facades\Storage;
class ProjectLogger
{
public static function log(Project $project, $message)
{
$filePath = $project->download_path . '/logs/' . now()->format('Ymd') . '.log';
Storage::makeDirectory(dirname($filePath));
file_put_contents(Storage::path($filePath), now()->format('Y-m-d H:i:s') . ': ' . $message . PHP_EOL, FILE_APPEND);
}
}