Created
January 17, 2014 03:13
-
-
Save cgsmith/8467799 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This is what the delete method looks like now | |
function delete($id) { | |
$bean = R::load($this->className,$id); | |
R::trash($bean); | |
$this->render($this->className.'/all','deleted'); | |
} | |
// This is what the delete method SHOULD look like for logging | |
use Monolog\Logger; | |
use Monolog\Handler\StreamHandler; // <-- these would be at the top of the controller | |
function delete($id) { | |
$bean = R::load($this->className,$id); | |
$log = new Logger('mylog'); | |
$log->pushHandler(new StreamHandler('pos.log', Logger::WARNING)); | |
$log->addInfo('Deleting ID#' .$id. ' in ' .$this->className. ' by User'); | |
R::trash($bean); | |
$this->render($this->className.'/all','deleted'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment