This commit is contained in:
Kekskurse 2021-01-17 01:03:52 +01:00
parent 510bca3666
commit faaff3b6d3
3 changed files with 60 additions and 0 deletions

View file

@ -39,6 +39,13 @@ class PublicController extends BaseController
}
public function returnImageFile($tenant, $gallery, $image, Request $request) {
$image = Image::query()->where("id", "=", $image)->firstOrFail();
$size = $request->input("size", "medium");
$file = Storage::disk($image->driver)->response($image->path);
return $file;
}
public function returnImageFile2($tenant, $gallery, $image, Request $request) {
$uid = uniqid();
Log::info($uid.": Start", [$image]);
$globalstart = microtime(true);

View file

@ -0,0 +1,27 @@
<?php
namespace App\Http\Middleware;
use App\Models\Tenant;
use Closure;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
class TenanMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
Log::info("Request Start", ["time" => microtime(true)]);
$r = $next($request);
Log::info("Request end", ["time" => microtime(true)]);
return $r;
}
}

26
app/Log.php Normal file
View file

@ -0,0 +1,26 @@
<?php
namespace App;
use Monolog\Processor\UidProcessor;
class Log
{
public function __invoke(Logger $logger)
{
/** @var Logger|\Monolog\Logger $logger */
/** @var StreamHandler[] $handlers */
$handlers = $logger->getHandlers();
foreach ($handlers as $handler) {
/*$handler->setFormatter(new LogstashFormatter('log', basename($handler->getUrl())));
$handler->pushProcessor(new FieldsProcessor());
$handler->pushProcessor(new WebProcessor());
$handler->pushProcessor(new IntrospectionProcessor());
$handler->pushProcessor(new GuardProcessor());
$handler->pushProcessor(new QueryBindingsProcessor());
$handler->pushProcessor(new HeadersProcessor());
$handler->pushProcessor(new BadResponseGuzzleProcessor());
*/
$handler->pushProcessor(new UidProcessor());
}
}
}