log icon indicating copy to clipboard operation
log copied to clipboard

Add get log destination Add check log empty

Open 8ctopus opened this issue 3 years ago • 0 comments

I've added code to check if the log is empty and where the log file is. Here's how I use it:

    foreach ($container['logger']->getBuckets() as $bucket) {
        // check not empty and at least warning (4)
        if (get_class($bucket) === 'Apix\\Log\\Logger\\File' && !$bucket->isEmpty()) {
            if (!$file = $bucket->getDestination()) {
                continue;
            }

            // get log content
            $content = file_get_contents($file, false);

           // send log by email
    }

8ctopus avatar Sep 09 '22 11:09 8ctopus