Log micropub requests to their own log file

This commit is contained in:
Jonny Barnes 2017-07-03 17:04:45 +01:00
parent 3099314fe0
commit d7e1165e7f

View file

@ -2,9 +2,10 @@
namespace App\Http\Controllers;
use Log;
use Monolog\Logger;
use Ramsey\Uuid\Uuid;
use App\{Media, Note, Place};
use Monolog\Handler\StreamHandler;
use Illuminate\Http\{Request, Response};
use App\Exceptions\InvalidTokenException;
use Phaza\LaravelPostgis\Geometries\Point;
@ -60,7 +61,9 @@ class MicropubController extends Controller
], 400);
}
// Log the request
Log::debug($request);
$logger = new Logger('micropub');
$logger->pushHandler(new StreamHandler(storage_path('logs/micropub.log')), Logger::DEBUG);
$logger->debug('MicropubLog', $request->all());
if ($tokenData->hasClaim('scope')) {
if (($request->input('h') == 'entry') || ($request->input('type.0') == 'h-entry')) {
if (stristr($tokenData->getClaim('scope'), 'create') === false) {