From 62f25c718ce247f38b28d519a11ddf88e66b8bf3 Mon Sep 17 00:00:00 2001 From: Sony? Date: Sun, 25 Nov 2012 10:34:05 +0100 Subject: [PATCH 1/3] Added a pretty_print option to the log class It isn't useful to log arrays if the result is 'Array'. I noticed that I often use `Log::info(print_r($array, true));` and I'am probably not alone, so why not add this as a feature to the framework? --- laravel/log.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/laravel/log.php b/laravel/log.php index f2b2b3f8..88477a69 100644 --- a/laravel/log.php +++ b/laravel/log.php @@ -33,14 +33,21 @@ protected static function exception_line($e) * * // Write an "error" message using the class' magic method * Log::error('Something went horribly wrong!'); + * + * // Log an arrays data + * Log::write('info', array('name' => 'Sawny', 'passwd' => '1234', array(1337, 21, 0)), true); + * //Result: Array ( [name] => Sawny [passwd] => 1234 [0] => Array ( [0] => 1337 [1] => 21 [2] => 0 ) ) + * //If we had omit the third parameter the result had been: Array * * * @param string $type * @param string $message * @return void */ - public static function write($type, $message) + public static function write($type, $message, $pretty_print = false) { + $message = ($pretty_print) ? print_r($message, true) : $message; + // If there is a listener for the log event, we'll delegate the logging // to the event and not write to the log files. This allows for quick // swapping of log implementations for debugging. @@ -75,11 +82,18 @@ protected static function format($type, $message) * * // Write a "warning" message to the log file * Log::warning('This is a warning!'); + * + * // Log an arrays data + * Log::info(array('name' => 'Sawny', 'passwd' => '1234', array(1337, 21, 0)), true); + * //Result: Array ( [name] => Sawny [passwd] => 1234 [0] => Array ( [0] => 1337 [1] => 21 [2] => 0 ) ) + * //If we had omit the second parameter the result had been: Array * */ public static function __callStatic($method, $parameters) { - static::write($method, $parameters[0]); + $parameters[1] = (empty($parameters[1])) ? false : $parameters[1]; + + static::write($method, $parameters[0], $parameters[1]); } } \ No newline at end of file From c63ed36c73ada77a9fec40b2d10778b2237e2b86 Mon Sep 17 00:00:00 2001 From: Darkimmortal Date: Thu, 27 Dec 2012 03:33:33 +0000 Subject: [PATCH 2/3] fixed white-on-white profiler text Signed-off-by: Darkimmortal --- laravel/profiling/profiler.css | 1 + 1 file changed, 1 insertion(+) diff --git a/laravel/profiling/profiler.css b/laravel/profiling/profiler.css index 63fc7658..48a7430b 100755 --- a/laravel/profiling/profiler.css +++ b/laravel/profiling/profiler.css @@ -8,6 +8,7 @@ .anbu right:0 !important; width:100%; z-index: 9999 !important; + color: #000; } .anbu-tabs From 77679a5659a5104042ec676237a5d61808155243 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Mon, 7 Jan 2013 01:20:46 +1100 Subject: [PATCH 3/3] Respect LARAVEL_ENV variable Laravel **should** respect `LARAVEL_ENV` variable when running through CLI --- laravel/core.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/laravel/core.php b/laravel/core.php index 0f33ccfd..cbfa089a 100644 --- a/laravel/core.php +++ b/laravel/core.php @@ -171,9 +171,9 @@ if (Request::cli()) { - $environment = get_cli_option('env'); + $environment = get_cli_option('env', getenv('LARAVEL_ENV')); - if ( ! isset($environment)) + if (empty($environment)) { $environment = Request::detect_env($environments, gethostname()); } @@ -240,4 +240,4 @@ foreach ($bundles as $bundle => $config) { Bundle::register($bundle, $config); -} \ No newline at end of file +}