Skip to content

Commit 6694ef1

Browse files
authored
Project setup (#1)
Add initial project
1 parent e392157 commit 6694ef1

File tree

184 files changed

+11817
-2
lines changed

Some content is hidden

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

184 files changed

+11817
-2
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.{yml, neon}]
18+
indent_size = 2

.gitattributes

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Text file attributes
2+
# - `text` Treat as text
3+
# - `eol=lf` Set line endings to LF
4+
# - `whitespace` Set whitespace properties
5+
# - `blank-at-eol` Treats trailing whitespaces at the end of a line as an error
6+
# - `blank-at-eof`Treat blank lines added at the end of file as an error
7+
# - `space-before-tab` Treat a space character that appears immediately before a tab character in the initial indent part of the line as an error
8+
# - `tab-in-indent` Treats a tab character in the initial indent part of the line as an error
9+
# - `tabwidth` Tells how many character positions a tab occupies
10+
# - `diff=html` & `diff=php` Diff is shown using the specified diff driver.
11+
*.css text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
12+
*.html text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4 diff=html
13+
*.js text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
14+
*.json text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
15+
*.lock text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
16+
*.php text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4 diff=php
17+
*.scss text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
18+
*.sh text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4 diff=php
19+
*.sql text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
20+
*.svg text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
21+
*.ts text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
22+
*.twig text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
23+
*.txt text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
24+
*.xml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
25+
*.xml.dist text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
26+
*.xsd text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
27+
.editorconfig text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
28+
.env.* text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
29+
.eslintignore text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
30+
.eslintrc text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
31+
.gitattributes text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
32+
.gitignore text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
33+
.gitkeep text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
34+
.htaccess text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
35+
36+
*.md text eol=lf whitespace=-blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=4
37+
38+
*.neon text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
39+
*.yaml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
40+
*.yml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
41+
42+
# Binary file attributes
43+
# - `-text` Treat as binary file
44+
# - `diff` Include binary diff in patches instead of "binary files differ."
45+
*.gif -text diff
46+
*.gz -text diff
47+
*.ico -text diff
48+
*.jpeg -text diff
49+
*.jpg -text diff
50+
*.phar -text diff
51+
*.png -text diff
52+
*.svgz -text diff
53+
*.ttf -text diff
54+
*.woff -text diff
55+
*.woff2 -text diff
56+
57+
# Exclude directories/files from composer vendor package
58+
/dev export-ignore
59+
/frontend export-ignore
60+
/tests export-ignore
61+
/.* export-ignore
62+
/*.sh export-ignore
63+
/php*.json export-ignore
64+
/php*.xml export-ignore
65+
/php*.dist export-ignore
66+
/php*.neon export-ignore
67+
/renovate.json export-ignore

.github/workflows/test.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Run checks
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: PHP ${{ matrix.php-versions }} - Test ${{ matrix.composer-flags }}
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
php-versions: [ '8.1', '8.2', '8.3' ]
19+
composer-flags: [ '', '--prefer-lowest' ]
20+
exclude:
21+
- php-versions: 8.3
22+
composer-flags: ''
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-versions }}
30+
coverage: none
31+
32+
- name: Validate composer.json and composer.lock
33+
run: composer validate
34+
35+
- name: Install dependencies
36+
run: composer update --prefer-dist --no-progress --no-suggest --prefer-stable ${{ matrix.composer-flags }}
37+
38+
- name: Run test suite
39+
run: composer test
40+
41+
coverage:
42+
name: PHP 8.3 - Test with coverage
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- name: Setup PHP
48+
uses: shivammathur/setup-php@v2
49+
with:
50+
php-version: 8.3
51+
coverage: pcov
52+
53+
- name: Install dependencies
54+
run: composer update --prefer-dist --no-progress --no-suggest --prefer-stable
55+
56+
- name: Run test suite
57+
run: php -dpcov.enabled=1 -dpcov.exclude="~vendor~" vendor/bin/phpunit --testsuite unit,integration --coverage-clover ./.coverage/coverage.xml
58+
59+
- name: Check coverage
60+
run: test ! -f ./.coverage/coverage.xml || php vendor/bin/phpfci inspect ./.coverage/coverage.xml --exit-code-on-failure --reportText
61+
62+
php-quality:
63+
name: PHP quality checks
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- name: Setup PHP
69+
uses: shivammathur/setup-php@v2
70+
with:
71+
php-version: 8.1
72+
coverage: none
73+
74+
- name: Install dependencies
75+
run: composer install --prefer-dist --no-progress --no-suggest
76+
77+
- name: run checks
78+
run: composer check
79+
80+
ts-quality:
81+
name: Typescript quality checks
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v4
85+
- name: Use Node.js 21.x
86+
uses: actions/setup-node@v3
87+
with:
88+
node-version: 21.x
89+
90+
- name: Install dependencies
91+
run: cd frontend && npm install
92+
93+
- name: Run eslint
94+
run: cd frontend && npm run lint
95+
96+
build-assets-check:
97+
name: Check build assets
98+
runs-on: ubuntu-latest
99+
steps:
100+
- uses: actions/checkout@v4
101+
- name: Use Node.js 21.x
102+
uses: actions/setup-node@v3
103+
with:
104+
node-version: 21.x
105+
106+
- name: Install dependencies
107+
run: cd frontend && npm install
108+
109+
- name: Build assets
110+
run: cd frontend && npm run build
111+
112+
- name: Git diff - expecting no changes
113+
run: git status | grep "nothing to commit, working tree clean"

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.idea
2+
/vendor
3+
/composer.lock
4+
/phpunit.xml
5+
/.phpunit.result.cache
6+
/dev/public/bundles
7+
/dev/var

CONTRIBUTING.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
We accept contributions via Pull Requests on [Github](https://github.com/).
6+
7+
8+
## Pull Requests
9+
10+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
11+
12+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
13+
14+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
15+
16+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
17+
18+
- **Create feature branches** - Don't ask us to pull from your master branch.
19+
20+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
21+
22+
## Development
23+
24+
### Requirements
25+
- [docker >= 20.10](https://docs.docker.com/engine/install/)
26+
- [docker compose plugin](https://docs.docker.com/compose/install/linux/)
27+
28+
### Getting started
29+
A minimal Symfony project has been setup under `/dev/`. To start development, in the root of the project:
30+
31+
```bash
32+
./start.sh [--port <nr>]
33+
```
34+
35+
After the containers are up and running, the project is available at http://localhost:8888.
36+
37+
> **_NOTE:_** the nodejs container will automatically rebuild the frontend assets and deploy them in the `/public/` directory
38+
39+
> **_NOTE:_** When making changes to the frontend, ensure committing the compiled assets.
40+
41+
## Running tests and code style checks
42+
43+
``` bash
44+
composer check
45+
composer test
46+
```

README.md

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,71 @@
1-
# symfony-log-viewer-bundle
2-
A log viewer for Symfony
1+
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.1-8892BF)](https://php.net/)
2+
[![Minimum Symfony Version](https://img.shields.io/badge/symfony-%3E%3D%206.0-brightgreen)](https://symfony.com/doc/current/validation.html)
3+
![Run tests](https://github.com/frankdekker/symfony-log-viewer-bundle/actions/workflows/test.yml/badge.svg)
4+
5+
<div style="text-align: center">
6+
<h1 style="margin-bottom:0">Log viewer for Symfony</h1>
7+
<i>Inspired by <a href="https://github.com/opcodesio/log-viewer">opcodesio/log-viewer</a></i>
8+
<img src="docs/images/preview.png" alt="log-viewer">
9+
</div>
10+
11+
**Log Viewer**: a bundle for your [Symfony](https://symfony.com/) app. It provides a user-friendly UI to read, filter and search log files.
12+
13+
Out of the box it will read your Monolog logs in the `var/log` directory, but can be configured to
14+
read logs from any directory.
15+
16+
17+
### Features
18+
19+
- 📂 **View all the Monolog logs** in your `%kernel.logs_dir%` directory,
20+
- 🔍 **Search** the logs,
21+
- 🎚 **Filter** by log level (error, info, debug, etc.), or by channel.
22+
- 🌑 **Dark mode**,
23+
- 💾 **Download** or **delete** log files from the UI,
24+
- ☎️ **API access** for folders, files & log entries,
25+
26+
## Getting started
27+
28+
### Requirements
29+
30+
- **PHP 8.1+**
31+
- **Symfony 6.0+ or 7.0+**
32+
33+
### Installation
34+
35+
Use [composer](https://getcomposer.org/).
36+
```bash
37+
composer require fdekker/log-viewer-bundle
38+
```
39+
If you don't use Symfony Flex, you'll need to manually enable the bundle:
40+
```php
41+
# /config/bundles.php
42+
return [
43+
// ...
44+
FD\LogViewer\FdLogViewerBundle::class => ['all' => true],
45+
];
46+
```
47+
And add the route by creating file `/config/routes/fd_log_viewer.php`:
48+
```php
49+
<?php
50+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
51+
52+
return static function (RoutingConfigurator $routingConfigurator): void {
53+
$routingConfigurator->import('.', 'fd_symfony_log_viewer')->prefix('/log-viewer');
54+
};
55+
```
56+
57+
After installing the package, publish the front-end assets by running:
58+
```bash
59+
php bin/console assets:install
60+
```
61+
62+
### Usage
63+
64+
Once the installation is complete, you will be able to access **Log Viewer** directly in your browser.
65+
66+
By default, the application is available at: `{APP_URL}/log-viewer`.
67+
68+
(for example: `https://my-app.test/log-viewer`)
69+
70+
## Configuration
71+
- [Adjust default configuration](docs/configuration.md)

0 commit comments

Comments
 (0)