13 public static function log(mixed
$data,
string $marker =
'DEBUG_SOCIALNETWORK'): void
15 $log =
new Log($marker);
17 if (
$data instanceof Throwable)
19 $collectedData = static::collectThrowable(
$data);
23 $collectedData = static::collectError(
$data);
27 $collectedData = static::collectErrorCollection(
$data);
31 $collectedData =
$data;
34 $log->collect($collectedData);
37 private static function collectThrowable(Throwable $throwable):
array
40 'type' =>
'throwable',
41 'message' => $throwable->getMessage(),
42 'file' => $throwable->getFile(),
43 'line' => $throwable->getLine(),
44 'backtrace' => $throwable->getTraceAsString(),
52 'message' =>
$error->getMessage(),
53 'code' =>
$error->getCode(),
54 'customData' =>
$error->getCustomData(),
58 private static function collectErrorCollection(ErrorCollection $errorCollection):
array
61 foreach ($errorCollection as
$error)
67 'type' =>
'errorCollection',
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)