Browse Source

Improved formatting

Christophe Coevoet 14 years ago
parent
commit
d746850316
2 changed files with 15 additions and 4 deletions
  1. 8 3
      doc/extending.md
  2. 7 1
      doc/usage.md

+ 8 - 3
doc/extending.md

@@ -47,8 +47,13 @@ class PDOHandler extends AbstractProcessingHandler
 
     private function initialize()
     {
-        $this->pdo->exec('CREATE TABLE IF NOT EXISTS monolog (channel VARCHAR(255), level INTEGER, message LONGTEXT, time INTEGER UNSIGNED)');
-        $this->statement = $this->pdo->prepare('INSERT INTO monolog (channel, level, message, time) VALUES (:channel, :level, :message, :time)');
+        $this->pdo->exec(
+            'CREATE TABLE IF NOT EXISTS monolog '
+            .'(channel VARCHAR(255), level INTEGER, message LONGTEXT, time INTEGER UNSIGNED)'
+        );
+        $this->statement = $this->pdo->prepare(
+            'INSERT INTO monolog (channel, level, message, time) VALUES (:channel, :level, :message, :time)'
+        );
     }
 }
 ```
@@ -66,4 +71,4 @@ $logger->addInfo('My logger is now ready');
 
 The `Monolog\Handler\AbstractProcessingHandler` class provides most of the
 logic needed for the handler, including the use of processors and the formatting
-of the record (which is why we use ``$record['formatted']`` instead of ``$record['message']``.
+of the record (which is why we use ``$record['formatted']`` instead of ``$record['message']``).

+ 7 - 1
doc/usage.md

@@ -50,7 +50,10 @@ Adding extra data in the records
 Monolog provides two different ways to add extra informations along the simple
 textual message.
 
-The first one is the context, allowing to pass an array of data along the
+Using the logging context
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The first way is the context, allowing to pass an array of data along the
 record:
 
 ```php
@@ -63,6 +66,9 @@ Simple handlers (like the StreamHandler for instance) will simply format
 the array to a string but richer handlers can take advantage of the context
 (FirePHP is able to display arrays in pretty way for instance).
 
+Using processors
+~~~~~~~~~~~~~~~~
+
 The second way is to add extra data for all records by using a processor.
 Processors can be any callable. They will get the record as parameter and
 must return it after having eventually changed the `extra` part of it. Let's