Bolt\Logger\Manager::trim PHP Method

trim() public method

Trim the log.
public trim ( string $log )
$log string
    public function trim($log)
    {
        $period = new \DateTime('-7 day');
        if ($log === 'change') {
            $this->changeRepository->trimLog($period);
        } elseif ($log === 'system') {
            $this->systemRepository->trimLog($period);
        } else {
            throw new \UnexpectedValueException("Invalid log type requested: {$log}");
        }
    }

Usage Example

Example #1
0
 public function testInvalid()
 {
     $app = $this->getApp();
     $log = new Manager($app);
     $this->setExpectedException('Exception', 'Invalid log type requested: invalid');
     $log->trim('invalid');
 }