Skip to content

Commit

Permalink
Update LaravelLogViewer.php
Browse files Browse the repository at this point in the history
  • Loading branch information
rap2hpoutre committed Dec 4, 2014
1 parent 0c352c5 commit 35e9d82
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,31 @@
use Psr\Log\LogLevel;
use ReflectionClass;

/**
* Class LaravelLogViewer
* @package Rap2hpoutre\LaravelLogViewer
*/
class LaravelLogViewer
{

/**
* @var current file
*/
private static $file;

/**
* @param $file
*/
public static function setFile($file)
{
if (File::exists(storage_path() . '/logs/' . $file)) {
self::$file = storage_path() . '/logs/' . $file;
}
}

/**
* @return array
*/
public static function all()
{
$log = array();
Expand All @@ -33,8 +46,6 @@ public static function all()
$file = File::get($log_file[0]);
}



preg_match_all($pattern, $file, $headings);

$log_data = preg_split($pattern, $file);
Expand Down Expand Up @@ -80,7 +91,7 @@ public static function all()
'date' => $current[1],
'text' => $current[2],
'in_file' => isset($current[3]) ? $current[3] : null,
'stack' => $log_data[$i],
'stack' => preg_replace("/^\n*/", '', $log_data[$i])
);
}
}
Expand All @@ -91,6 +102,10 @@ public static function all()
return $log;
}

/**
* @param bool $basename
* @return array
*/
public static function getFiles($basename = false)
{
$files = glob(storage_path() . '/logs/*');
Expand Down

0 comments on commit 35e9d82

Please sign in to comment.