-
Notifications
You must be signed in to change notification settings - Fork 0
Logging
PPA logs every action it does. But, unless you've explicitly set a custom logger, PPA will log or write its messages to /dev/null.
To receive log messages you need to set a custom logger after initialisation. Just to be sure: If you don't set the logger immediately after initialisation, you will loose some messages. For simplification, all messages will be english.
Your custom logger must implement the interface iPPA_Logger. The interface iPPA_Logger has the function log() which has to be overridden. In your custom Logger you can do what you want with the logCode and the message - the function is not intended to return some value.
Example:
\PPA\PPA::init($dataSourceName, $username, $password); // initialisation
\PPA\PPA::getInstance()->setLogger(new CustomLogger());class CustomLogger implements \PPA\core\iPPA_Logger {
public function log($logCode, $message) {
// make some incredible stuff here... e.g.:
\PPA\prettyDump("(" . $logCode . ") " . $message);
}
}You can also pass some logging options to PPA during initialisation. The logging options define which message classes you want to have logged.
Example:
\PPA\PPA::init($dataSourceName, $username, $password, array(
\PPA\PPA::OPTION_LOG_RETRIEVES => true,
\PPA\PPA::OPTION_LOG_NOTIFICATIONS => true
));For a complete list of options, message classes and the default values, look here.