MWDebug: Add support for passing objects
authorPranavK <pranavmk98@gmail.com>
Sun, 4 Jan 2015 07:20:45 +0000 (12:50 +0530)
committerTTO <at.light@live.com.au>
Sun, 24 Jan 2016 05:55:45 +0000 (05:55 +0000)
Change-Id: I121acab012676e486e19b3f8b0fae50af3d3a567

includes/debug/MWDebug.php

index 8f943bf..4faa1dd 100644 (file)
@@ -91,16 +91,16 @@ class MWDebug {
        /**
         * Adds a line to the log
         *
-        * @todo Add support for passing objects
-        *
         * @since 1.19
-        * @param string $str
+        * @param mixed $str
         */
        public static function log( $str ) {
                if ( !self::$enabled ) {
                        return;
                }
-
+               if ( !is_string( $str ) ) {
+                       $str = print_r( $str, true );
+               }
                self::$log[] = array(
                        'msg' => htmlspecialchars( $str ),
                        'type' => 'log',