summaryrefslogtreecommitdiff
path: root/docs/configuration.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/configuration.rst')
-rw-r--r--docs/configuration.rst34
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/configuration.rst b/docs/configuration.rst
index 395a1eb..a1c356a 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -65,6 +65,16 @@ once.
'etc' => 'etc'
));
+Use the ``get_config`` method to read current settings.
+
+.. code-block:: php
+
+ <?php
+ $isLoggingEnabled = ORM::get_config('logging');
+ ORM::configure('logging', false);
+ // some crazy loop we don't want to log
+ ORM::configure('logging', $isLoggingEnabled);
+
Database authentication details
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -215,6 +225,30 @@ the log. ``ORM::get_last_query()`` returns the most recent query
executed. ``ORM::get_query_log()`` returns an array of all queries
executed.
+Query logger
+^^^^^^^^^^^^
+
+Setting: ``logger``
+
+.. note::
+
+ You must enable ``logging`` for this setting to have any effect.
+
+It is possible to supply a ``callable`` to this configuration setting, which will
+be executed for every query that idiorm executes. In PHP a ``callable`` is anything
+that can be executed as if it were a function. Most commonly this will take the
+form of a anonymous function.
+
+This setting is useful if you wish to log queries with an external library as it
+allows you too whatever you would like from inside the callback function.
+
+.. code-block:: php
+
+ <?php
+ ORM::configure('logger', function($log_string) {
+ echo $log_string;
+ });
+
Query caching
^^^^^^^^^^^^^