@@ -33,14 +33,21 @@ protected static function exception_line($e)
33
33
*
34
34
* // Write an "error" message using the class' magic method
35
35
* Log::error('Something went horribly wrong!');
36
+ *
37
+ * // Log an arrays data
38
+ * Log::write('info', array('name' => 'Sawny', 'passwd' => '1234', array(1337, 21, 0)), true);
39
+ * //Result: Array ( [name] => Sawny [passwd] => 1234 [0] => Array ( [0] => 1337 [1] => 21 [2] => 0 ) )
40
+ * //If we had omit the third parameter the result had been: Array
36
41
* </code>
37
42
*
38
43
* @param string $type
39
44
* @param string $message
40
45
* @return void
41
46
*/
42
- public static function write ($ type , $ message )
47
+ public static function write ($ type , $ message, $ pretty_print = false )
43
48
{
49
+ $ message = ($ pretty_print ) ? print_r ($ message , true ) : $ message ;
50
+
44
51
// If there is a listener for the log event, we'll delegate the logging
45
52
// to the event and not write to the log files. This allows for quick
46
53
// swapping of log implementations for debugging.
@@ -75,11 +82,18 @@ protected static function format($type, $message)
75
82
*
76
83
* // Write a "warning" message to the log file
77
84
* Log::warning('This is a warning!');
85
+ *
86
+ * // Log an arrays data
87
+ * Log::info(array('name' => 'Sawny', 'passwd' => '1234', array(1337, 21, 0)), true);
88
+ * //Result: Array ( [name] => Sawny [passwd] => 1234 [0] => Array ( [0] => 1337 [1] => 21 [2] => 0 ) )
89
+ * //If we had omit the second parameter the result had been: Array
78
90
* </code>
79
91
*/
80
92
public static function __callStatic ($ method , $ parameters )
81
93
{
82
- static ::write ($ method , $ parameters [0 ]);
94
+ $ parameters [1 ] = (empty ($ parameters [1 ])) ? false : $ parameters [1 ];
95
+
96
+ static ::write ($ method , $ parameters [0 ], $ parameters [1 ]);
83
97
}
84
98
85
99
}
0 commit comments