-
Notifications
You must be signed in to change notification settings - Fork 89
Using custom logger class with CSRF Protector
minhaz edited this page Mar 17, 2018
·
1 revision
The csrfProtector::init
method now accepts an additional optional parameter $logger
public static function init($length = null, $action = null, $logger = null) {
This is supposed to be an object of a class that implements the LoggerInterface interface.
interface LoggerInterface {
public function log($message, $context = array());
}
In case the parameter is not provided - the default file based logger - csrfpDefaultLogger is used;
class CustomLogger implements LoggerInterface {
public function log($message, $context = array()) {
//// send the message to the slack channel :D
}
}
//// Initialize the library with this logger
csrfProtector::init(null, null, new CustomLogger());
PS: wiki still under development. Please create a Github issue for any correction.