Class QueryLog
This package wraps phramework's database adapter and keeps logs of the executed
queries and it's parameters.
The presence of this package once activated won't affect the rest of the system.
Defined settings:
- boolean disabled, [Optional], default is false
- object database, database settings
- string adapter, IAdapter's implementation class path Example:
'adapter' => 'Phramework\\Database\\MySQL',
- string name, Database name
- string username
- string password
- string host
- integer port
- string table, [Optional], Table name, default is `"query_log"`
- string schema, [Optional], Tables schema, default is null
- string adapter, IAdapter's implementation class path
- object matrix, [Optional], Log level matrix, using this matrix queries from specific or all class methods can be excluded from logging. The log will be excluded if the above have a non positive value and they are contained in the current backtrace. Example:
'matrix' => (object)[ 'MyNamespace\\MyClass' => false, 'MyNamespace\\MySecondClass' => (object)[ 'GET' => false ], ],
Namespace: Phramework\QueryLog
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Example:
Located at QueryLog.php
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Example:
//Let's assume $settings is global phramework's settings array //... After the use of \Phramework\Database\Database::setAdapter method, //the global adapter is initialized //Now we can create a QueryLog object $queryLog = new \Phramework\QueryLog\QueryLog($settings['query-log']); //And register this object, using additional parameters. $queryLog->register(['API' => 'base']); //Now we can invoke phramework's instance //Queries executed from this point forward are now logged based on the provided rules //Execute API $phramework->invoke();
Located at QueryLog.php
Methods summary
public
|
|
public
boolean
|
Properties summary
protected
array
|
$settings
|