public function testSkipResultLogger() { $this->log->useFiles($this->getDir() . '/.testing.log'); /** @var \__Test\AspectLoggable $cache */ $cache = $this->app->make(\__Test\AspectLoggable::class); $cache->skipResultLog(1); $put = $this->app['files']->get($this->getDir() . '/.testing.log'); $this->assertContains('Loggable:__Test\\AspectLoggable.skipResultLog', $put); $this->assertNotContains('"result":1', $put); }
public function testShouldNotPutExceptionLoggerFile() { $this->log->useFiles($this->getDir() . '/.testing.exceptions.log'); /** @var \__Test\AspectLogExceptions $logger */ $logger = $this->app->make(\__Test\AspectLogExceptions::class); try { $logger->expectNoException(); } catch (\Ytake\LaravelAspect\Exception\FileNotFoundException $e) { $this->assertFileNotExists($this->getDir() . '/.testing.exceptions.log'); } $this->app['files']->deleteDirectory($this->getDir()); }
<?php require_once 'vendor/autoload.php'; date_default_timezone_set('America/Detroit'); /** * Illuminate/log * * @source https://github.com/illuminate/log */ $app = new \Slim\Slim(); $app->get('/', function () { // Create new writer instance with dependencies $log = new Illuminate\Log\Writer(new Monolog\Logger('Torch Logger')); // Setup log file location $log->useFiles('./logs/torch.log'); // Actual log(s) $log->info('Logging an info message'); $log->error('Logging an error message'); $log->notice('Logging a notice message'); echo str_replace("\n", "<br>", file_get_contents('./logs/torch.log')); }); $app->run();