PHP midgard_connection method set_debuglevel
Set log verbosity level.
void set_debuglevel(level);
midgard_connection method set_debuglevel takes one parameter and may be called statically.
- level string
Available and usable levels:
- warn ( or warning)
- info
- message
- debug
The default warn will produce only warning logs. info and message provides functions and method names be written to log file with additional messages produced by invoked functions. debug produces function and method names and all SQL queries.
You may set debuglevel as many time as needed during runtime. Log level is limited to currently invoked application, even if more than one reuse the same configuration and underlying connection to the same database.
This method overwrites loglevel set in unified configuration. Log messages may be written to defined log file.
Example
<?php
midgard_connection::set_debuglevel("info");
try
{
$object = midgard_person(123);
}
catch(midgard_error_exception $e)
{
echo "Failed to get object" . $e->getMessage();
}
$object->lastname = "Smith";
midgard_connection::set_debuglevel("debug");
if(!$object->update()) {
if(midgard_connection::get_error() = MGD_ERR_ACCESS_DENIED)
echo "You are not allowed to edit this document";
}
midgard_connection::set_debuglevel("warn")
?>
