Skip to content

Commit 40ed823

Browse files
authored
Merge pull request #250 from opcodesio/access-logs
v3 - support for different log types, performance & other improvements
2 parents 583a2fa + fbc7d62 commit 40ed823

File tree

104 files changed

+3287
-1132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+3287
-1132
lines changed

.github/workflows/fix-php-code-style-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
ref: ${{ github.head_ref }}
1717

1818
- name: Fix PHP code style issues
19-
uses: aglipanci/laravel-pint-action@0.1.0
19+
uses: aglipanci/laravel-pint-action@1.0.0
2020

2121
- name: Commit changes
2222
uses: stefanzweifel/git-auto-commit-action@v4

.github/workflows/run-tests.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,20 @@ jobs:
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
1616
php: [8.1, 8.0]
17-
laravel: [9.*]
17+
laravel: [9.*, 10.*]
1818
stability: [prefer-lowest, prefer-stable]
19+
exclude:
20+
- php: 8.0
21+
laravel: 10.*
1922
include:
2023
- laravel: 9.*
2124
testbench: 7.*
25+
pest: 1.*
26+
collision: 6.*
27+
- laravel: 10.*
28+
testbench: 8.*
29+
pest: 2.*
30+
collision: 7.*
2231

2332
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2433

@@ -40,7 +49,7 @@ jobs:
4049
4150
- name: Install dependencies
4251
run: |
43-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
52+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "pestphp/pest:${{ matrix.pest }}" "pestphp/pest-plugin-laravel:${{ matrix.pest }}" "nunomaduro/collision:${{ matrix.collision }}" --no-interaction --no-update
4453
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
4554
4655
- name: Execute tests

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ phpstan.neon
1010
testbench.yaml
1111
vendor
1212
node_modules
13+
tests/Feature/performance_test.log

composer.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "opcodesio/log-viewer",
3-
"version": "v2.5.4",
43
"description": "Fast and easy-to-use log viewer for your Laravel application",
54
"keywords": [
65
"arukompas",
@@ -27,11 +26,10 @@
2726
"guzzlehttp/guzzle": "^7.2",
2827
"itsgoingd/clockwork": "^5.1",
2928
"laravel/pint": "^1.0",
30-
"nunomaduro/collision": "^6.0",
29+
"nunomaduro/collision": "^7.0",
3130
"orchestra/testbench": "^7.6|^8.0",
32-
"pestphp/pest": "^1.21",
33-
"pestphp/pest-plugin-laravel": "^1.1",
34-
"phpunit/phpunit": "^9.5",
31+
"pestphp/pest": "^2.0",
32+
"pestphp/pest-plugin-laravel": "^2.0",
3533
"spatie/test-time": "^1.3"
3634
},
3735
"suggest": {

config/log-viewer.php

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
use Opcodes\LogViewer\Level;
4-
53
return [
64

75
/*
@@ -134,6 +132,19 @@
134132
'include_files' => [
135133
'*.log',
136134
'**/*.log',
135+
136+
// You can include paths to other log types as well, such as apache, nginx, and more.
137+
'/var/log/httpd/*',
138+
'/var/log/nginx/*',
139+
140+
// MacOS Apple Silicon logs
141+
'/opt/homebrew/var/log/nginx/*',
142+
'/opt/homebrew/var/log/httpd/*',
143+
'/opt/homebrew/var/log/php-fpm.log',
144+
'/opt/homebrew/var/log/postgres*log',
145+
'/opt/homebrew/var/log/redis*log',
146+
'/opt/homebrew/var/log/supervisor*log',
147+
137148
// '/absolute/paths/supported',
138149
],
139150

@@ -164,35 +175,6 @@
164175
'/vendor/barryvdh/laravel-debugbar/',
165176
],
166177

167-
/*
168-
|--------------------------------------------------------------------------
169-
| Log matching patterns
170-
|--------------------------------------------------------------------------
171-
| Regexes for matching log files
172-
|
173-
*/
174-
175-
'patterns' => [
176-
'laravel' => [
177-
'log_matching_regex' => '/^\[(\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}\.?(\d{6}([\+-]\d\d:\d\d)?)?)\].*/',
178-
179-
/**
180-
* This pattern, used for processing Laravel logs, returns these results:
181-
* $matches[0] - the full log line being tested.
182-
* $matches[1] - full timestamp between the square brackets (includes microseconds and timezone offset)
183-
* $matches[2] - timestamp microseconds, if available
184-
* $matches[3] - timestamp timezone offset, if available
185-
* $matches[4] - contents between timestamp and the severity level
186-
* $matches[5] - environment (local, production, etc)
187-
* $matches[6] - log severity (info, debug, error, etc)
188-
* $matches[7] - the log text, the rest of the text.
189-
*/
190-
'log_parsing_regex' => '/^\[(\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}\.?(\d{6}([\+-]\d\d:\d\d)?)?)\](.*?(\w+)\.|.*?)('
191-
.implode('|', array_filter(Level::caseValues()))
192-
.')?: (.*?)( in [\/].*?:[0-9]+)?$/is',
193-
],
194-
],
195-
196178
/*
197179
|--------------------------------------------------------------------------
198180
| Cache driver

phpunit.xml.dist

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5-
backupGlobals="false"
6-
backupStaticAttributes="false"
7-
bootstrap="vendor/autoload.php"
8-
colors="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
12-
processIsolation="false"
13-
stopOnFailure="false"
14-
executionOrder="random"
15-
failOnWarning="true"
16-
failOnRisky="true"
17-
failOnEmptyTestSuite="true"
18-
beStrictAboutOutputDuringTests="true"
19-
verbose="true"
20-
>
21-
<testsuites>
22-
<testsuite name="Opcodes LogViewer Test Suite">
23-
<directory>tests</directory>
24-
</testsuite>
25-
</testsuites>
26-
<coverage>
27-
<include>
28-
<directory suffix=".php">./src</directory>
29-
</include>
30-
<report>
31-
<html outputDirectory="build/coverage"/>
32-
<text outputFile="build/coverage.txt"/>
33-
<clover outputFile="build/logs/clover.xml"/>
34-
</report>
35-
</coverage>
36-
<logging>
37-
<junit outputFile="build/report.junit.xml"/>
38-
</logging>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<testsuites>
4+
<testsuite name="Opcodes Log Viewer Test Suite">
5+
<directory>tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
<coverage>
9+
<report>
10+
<html outputDirectory="build/coverage"/>
11+
<text outputFile="build/coverage.txt"/>
12+
<clover outputFile="build/logs/clover.xml"/>
13+
</report>
14+
</coverage>
15+
<logging>
16+
<junit outputFile="build/report.junit.xml"/>
17+
</logging>
18+
<php>
19+
<env name="LOG_VIEWER_CACHE_DRIVER" value="array"/>
20+
</php>
21+
<source>
22+
<include>
23+
<directory suffix=".php">./src</directory>
24+
</include>
25+
</source>
3926
</phpunit>

pint.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"preset": "laravel",
3+
"rules": {
4+
"class_attributes_separation": {
5+
"elements": {
6+
"const": "none",
7+
"method": "one",
8+
"property": "none",
9+
"trait_import": "none",
10+
"case": "none"
11+
}
12+
}
13+
}
14+
}

public/app.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"/app.js": "/app.js?id=65bcb5cc7b0f371b0d28d1b07e92cc53",
3-
"/app.css": "/app.css?id=93151d8b186ef7758df8582425ff8082",
2+
"/app.js": "/app.js?id=e7bdf4c9df5545d0907880d43b7adf71",
3+
"/app.css": "/app.css?id=2644d93568c08a41a0612c7c2c38618e",
44
"/img/log-viewer-128.png": "/img/log-viewer-128.png?id=d576c6d2e16074d3f064e60fe4f35166",
55
"/img/log-viewer-32.png": "/img/log-viewer-32.png?id=f8ec67d10f996aa8baf00df3b61eea6d",
66
"/img/log-viewer-64.png": "/img/log-viewer-64.png?id=8902d596fc883ca9eb8105bb683568c6"

0 commit comments

Comments
 (0)