Skip to content

Commit

Permalink
Merge pull request #14 from kingsquare/querylogger
Browse files Browse the repository at this point in the history
Added a QueryLogger a la the doctrine/dbal SQLLogger (literally)
  • Loading branch information
AubreyHewes committed Jun 22, 2015
2 parents bb21011 + aa18a3d commit 4656e9e
Show file tree
Hide file tree
Showing 8 changed files with 453 additions and 102 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,26 @@ try {
print_r($e->getErrors());
}
```

### Query Logging

It is also possible to add a query logger to the connector.

#### Stack query data for debug/dev purposes:

$connector->setQueryLogger(new DebugStack());

Query data available after run via `$connector->getQueryLogger()->queries`

#### Echo query for debug/dev purposes (handy for cli):

$connector->setQueryLogger(new EchoQueryLogger());

Echoes each query to the current output stream.

#### Create own query logging:

$connector->setQueryLogger(new MyOwnQueryLogger());

`MyOwnQueryLogger` implements `QueryLogger` and does something with the data.. possible db/api call

4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "kingsquare/communibase-connector-php",
"version": "1.1.0",
"description": "This is the Communibase connector for PHP.",
"keywords": ["communibase", "connector"],
"type": "library",
"license": "MIT",
"authors": [
{ "name": "Tim de Koning", "email": "tim@kingsquare.nl" },
{ "name": "Robin Speekenbrink", "email": "robin@kingsquare.nl" }
{ "name": "Robin Speekenbrink", "email": "robin@kingsquare.nl" },
{ "name": "Aubrey Hewes", "email": "aubrey@kingsquare.nl" }
],
"require": {
"php": ">=5.3",
Expand Down
Loading

0 comments on commit 4656e9e

Please sign in to comment.