*
* This function will set a callback function to be called for {@link http://www.php.net/manual/en/class.mongolog.php MongoLog} events
* instead of triggering warnings.
*
* @link http://www.php.net/manual/en/mongolog.setcallback.php
* @param callable $log_function
* The function to be called on events.
*
*
* The function should have the following prototype
*
*
* log_function ( int $module , int $level, string $message)
*
* -
* module
*
*
One of the {@link http://www.php.net/manual/en/class.mongolog.php#mongolog.constants.module MongoLog module constants}.
*
* -
* level
*
*
One of the {@link http://www.php.net/manual/en/class.mongolog.php#mongolog.constants.level MongoLog level constants}.
*
* message
*
* The log message itself.
*
* @return boolean Returns TRUE on success or FALSE on failure.
*/
public static function setCallback(callable $log_function)
{
self::$callback = $log_function;
return true;
}
/**
* This function can be used to set how verbose logging should be and the types of
* activities that should be logged. Use the constants described in the MongoLog
* section with bitwise operators to specify levels.
*
* @link http://php.net/manual/en/mongolog.setlevel.php
* @static
* @param int $level The levels you would like to log
* @return void
*/
public static function setLevel($level)
{
self::$level = $level;
}
/**
* This can be used to see the log level. Use the constants described in the
* MongoLog section with bitwise operators to check the level.
*
* @link http://php.net/manual/en/mongolog.getlevel.php
* @static
* @return int Returns the current level
*/
public static function getLevel()
{
return self::$level;
}
/**
* This function can be used to set which parts of the driver's functionality
* should be logged. Use the constants described in the MongoLog section with
* bitwise operators to specify modules.
*
* @link http://php.net/manual/en/mongolog.setmodule.php
* @static
* @param int $module The module(s) you would like to log
* @return void
*/
public static function setModule($module)
{
self::$module = $module;
}
/**
* This function can be used to see which parts of the driver's functionality are
* being logged. Use the constants described in the MongoLog section with bitwise
* operators to check if specific modules are being logged.
*
* @link http://php.net/manual/en/mongolog.getmodule.php
* @static
* @return int Returns the modules currently being logged
*/
public static function getModule()
{
return self::$module;
}
}