Skip to content
This repository
Browse code

Rewrap README

  • Loading branch information...
commit 3b910c39a7df3c66e1c60d8b6a4edcfb8749b61a 1 parent 4b2c47d
Jordi Boggiano authored April 22, 2012

Showing 1 changed file with 61 additions and 20 deletions. Show diff stats Hide diff stats

  1. 81  README.mdown
81  README.mdown
Source Rendered
@@ -20,15 +20,34 @@ Usage
20 20
 Core Concepts
21 21
 -------------
22 22
 
23  
-Every Logger instance has a channel (name) and a stack of handlers. Whenever you add a record to the logger, it traverses the handler stack. Each handler decides whether it handled fully the record, and if so, the propagation of the record ends there.
24  
-
25  
-This allow for flexible logging setups, for example having a FileHandler at the bottom of the stack that will log anything to disk, and on top of that add a MailHandler that will send emails only when an error message is logged. Handlers also have a bubbling property which define whether they block the record or not if they handled it. In this example, setting the MailHandler's $bubble argument to true means that all records will propagate to the FileHandler, even the errors that are handled by the MailHandler.
26  
-
27  
-You can create many Loggers, each defining a channel (e.g.: db, request, router, ..) and each of them combining various handlers, which can be shared or not. The channel is reflected in the logs and allows you to easily see or filter records.
28  
-
29  
-Each Handler also has a Formatter, a default one with settings that make sense will be created if you don't set one. The formatters normalize and format incoming records so that they can be used by the handlers to output useful information.
30  
-
31  
-Custom severity levels are not available. Only six levels (debug, info, warning, error, critical, alert) are present for basic filtering purposes, but for sorting and other use cases that would require flexibility, you should add Processors to the Logger that can add extra information (tags, user ip, ..) to the records before they are handled.
  23
+Every Logger instance has a channel (name) and a stack of handlers. Whenever
  24
+you add a record to the logger, it traverses the handler stack. Each handler
  25
+decides whether it handled fully the record, and if so, the propagation of the
  26
+record ends there.
  27
+
  28
+This allow for flexible logging setups, for example having a FileHandler at
  29
+the bottom of the stack that will log anything to disk, and on top of that add
  30
+a MailHandler that will send emails only when an error message is logged.
  31
+Handlers also have a bubbling property which define whether they block the
  32
+record or not if they handled it. In this example, setting the MailHandler's
  33
+$bubble argument to true means that all records will propagate to the
  34
+FileHandler, even the errors that are handled by the MailHandler.
  35
+
  36
+You can create many Loggers, each defining a channel (e.g.: db, request,
  37
+router, ..) and each of them combining various handlers, which can be shared
  38
+or not. The channel is reflected in the logs and allows you to easily see or
  39
+filter records.
  40
+
  41
+Each Handler also has a Formatter, a default one with settings that make sense
  42
+will be created if you don't set one. The formatters normalize and format
  43
+incoming records so that they can be used by the handlers to output useful
  44
+information.
  45
+
  46
+Custom severity levels are not available. Only six levels (debug, info,
  47
+warning, error, critical, alert) are present for basic filtering purposes, but
  48
+for sorting and other use cases that would require flexibility, you should add
  49
+Processors to the Logger that can add extra information (tags, user ip, ..) to
  50
+the records before they are handled.
32 51
 
33 52
 Docs
34 53
 ====
@@ -39,24 +58,45 @@ Handlers
39 58
 --------
40 59
 
41 60
 - _StreamHandler_: Logs records into any php stream, use this for log files.
42  
-- _RotatingFileHandler_: Logs records to a file and creates one logfile per day. It will also delete files older than $maxFiles. You should use [logrotate](http://linuxcommand.org/man_pages/logrotate8.html) for high profile setups though, this is just meant as a quick and dirty solution.
43  
-- _FirePHPHandler_: Handler for [FirePHP](http://www.firephp.org/), providing inline `console` messages within [FireBug](http://getfirebug.com/).
44  
-- _ChromePHPHandler_: Handler for [ChromePHP](http://www.chromephp.com/), providing inline `console` messages within Chrome.
45  
-- _MongoDBHandler_: Handler to write records in MongoDB via a [Mongo](http://pecl.php.net/package/mongo) extension connection.
  61
+- _RotatingFileHandler_: Logs records to a file and creates one logfile per day.
  62
+  It will also delete files older than $maxFiles. You should use
  63
+  [logrotate](http://linuxcommand.org/man_pages/logrotate8.html) for high profile
  64
+  setups though, this is just meant as a quick and dirty solution.
  65
+- _FirePHPHandler_: Handler for [FirePHP](http://www.firephp.org/), providing
  66
+  inline `console` messages within [FireBug](http://getfirebug.com/).
  67
+- _ChromePHPHandler_: Handler for [ChromePHP](http://www.chromephp.com/), providing
  68
+  inline `console` messages within Chrome.
  69
+- _MongoDBHandler_: Handler to write records in MongoDB via a
  70
+  [Mongo](http://pecl.php.net/package/mongo) extension connection.
46 71
 - _NativeMailHandler_: Sends emails using PHP's mail() function.
47 72
 - _SwiftMailerHandler_: Sends emails using a SwiftMailer instance.
48 73
 - _SyslogHandler_: Logs records to the syslog.
49 74
 - _GelfHandler_: Logs records to a [Graylog2](http://www.graylog2.org) server.
50  
-- _SocketHandler_: Logs records to [sockets](http://php.net/fsockopen), use this for UNIX and TCP sockets. See an [example](https://github.com/Seldaek/monolog/blob/master/doc/sockets.md).
  75
+- _SocketHandler_: Logs records to [sockets](http://php.net/fsockopen), use this
  76
+  for UNIX and TCP sockets. See an [example](https://github.com/Seldaek/monolog/blob/master/doc/sockets.md).
51 77
 
52 78
 Wrappers / Special Handlers
53 79
 ---------------------------
54 80
 
55  
-- _FingersCrossedHandler_: A very interesting wrapper. It takes a logger as parameter and will accumulate log records of all levels until a record exceeds the defined severity level. At which point it delivers all records, including those of lower severity, to the handler it wraps. This means that until an error actually happens you will not see anything in your logs, but when it happens you will have the full information, including debug and info records. This provides you with all the information you need, but only when you need it.
56  
-- _NullHandler_: Any record it can handle will be thrown away. This can be used to put on top of an existing handler stack to disable it temporarily.
57  
-- _BufferHandler_: This handler will buffer all the log records it receives until close() is called at which point it will call handleBatch() on the handler it wraps with all the log messages at once. This is very useful to send an email with all records at once for example instead of having one mail for every log record.
58  
-- _GroupHandler_: This handler groups other handlers. Every record received is sent to all the handlers it is configured with.
59  
-- _TestHandler_: Used for testing, it records everything that is sent to it and has accessors to read out the information.
  81
+- _FingersCrossedHandler_: A very interesting wrapper. It takes a logger as
  82
+  parameter and will accumulate log records of all levels until a record
  83
+  exceeds the defined severity level. At which point it delivers all records,
  84
+  including those of lower severity, to the handler it wraps. This means that
  85
+  until an error actually happens you will not see anything in your logs, but
  86
+  when it happens you will have the full information, including debug and info
  87
+  records. This provides you with all the information you need, but only when
  88
+  you need it.
  89
+- _NullHandler_: Any record it can handle will be thrown away. This can be used
  90
+  to put on top of an existing handler stack to disable it temporarily.
  91
+- _BufferHandler_: This handler will buffer all the log records it receives
  92
+  until close() is called at which point it will call handleBatch() on the
  93
+  handler it wraps with all the log messages at once. This is very useful to
  94
+  send an email with all records at once for example instead of having one mail
  95
+  for every log record.
  96
+- _GroupHandler_: This handler groups other handlers. Every record received is
  97
+  sent to all the handlers it is configured with.
  98
+- _TestHandler_: Used for testing, it records everything that is sent to it and
  99
+  has accessors to read out the information.
60 100
 
61 101
 Formatters
62 102
 ----------
@@ -104,4 +144,5 @@ Monolog is licensed under the MIT License - see the LICENSE file for details
104 144
 Acknowledgements
105 145
 ----------------
106 146
 
107  
-This library is heavily inspired by Python's [Logbook](http://packages.python.org/Logbook/) library, although most concepts have been adjusted to fit to the PHP world.
  147
+This library is heavily inspired by Python's [Logbook](http://packages.python.org/Logbook/)
  148
+library, although most concepts have been adjusted to fit to the PHP world.

0 notes on commit 3b910c3

Please sign in to comment.
Something went wrong with that request. Please try again.