├── LICENSE ├── README.md ├── example.log ├── ideologSymfonyFormat.xml ├── ideolog_settings.png └── regex_test.jpg /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Damian Szczerbiński 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cheatsheet for PHPStorm Ideolog Symfony logs format 2 | 3 | ## Requirements 4 | 5 | * PHPStorm 6 | * Installed and running **Ideolog** plugin 7 | 8 | ## Import settings 9 | 10 | Easiest way is to import Ideolog settings into your IDE. 11 | 12 | 1. Download `ideologSymfonyFormat.xml` file. 13 | 2. Go to *Settings -> Editor -> Log highlighting (Ideolog)*. 14 | 3. Click *Import* button and select downloaded XML file. Activate new pattern if needed. 15 | 4. Download or copy/paste `example.log` to test if everything is OK. 16 | 17 | 18 | ## Manual setting up 19 | 1. Go to *Settings -> Editor -> Log highlighting (Ideolog)*. 20 | 2. Add new *Log format* (plus sign on the right of the top list). 21 | 3. Put a name *Symfony* or whatever suits You. 22 | 4. In the field *Message pattern* place this regex: `^\[(\d{4}-\d{2}-\d{2}[T\s]?\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[\+-]\d{2}:?\d{2})?)]\s+(\w+)\.(\w+):([^\n]*)$` 23 | 5. In the field *Message start pattern* put this regex: `^[\[#]`. 24 | 6. In the field *Time format* put pattern that matches your case, e.g.: `yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ`. 25 | 7. In the field *Time capture group* set number **1**. 26 | 8. In the field *Severity capture group* set number **3**. 27 | 9. In the field *Category capture group* set number **2**. 28 | 10. Push *OK* button. You're almost done! 29 | 30 | ## Tweaks 31 | 32 | ### Critical severity 33 | To make *CRITICAL* severity to highlight do following steps: 34 | 1. Go to *Settings -> Editor -> Log highlighting (Ideolog)*. 35 | 2. Add new *Pattern* (plus sign on the right of the bottom-left list). 36 | 3. Enter new pattern: `^\s*c(ritical)?\s*$` 37 | 4. Select newly created pattern on the list and click *Edit* icon on the right. 38 | 5. Under pattern input box, select *highlight line* option. 39 | 6. Check *Foreground*, click on the color field. In new dialog window, at top of the right corner, type red color in hex `#F00` and push *Enter* key. 40 | 7. Uncheck *Background*. 41 | 8. Click *OK* button, close settings and You're done! 42 | 43 | 44 | #### Here is a screenshot of all actions described above. 45 | ![PHPStorm Ideolog Symfony logs format](ideolog_settings.png) 46 | 47 | #### Test case 48 | ![PHPStorm Test case](regex_test.jpg) 49 | -------------------------------------------------------------------------------- /example.log: -------------------------------------------------------------------------------- 1 | [ATOM/W3C compliance (Y-m-d\TH:i:sP)] 2 | [2021-03-09T12:37:10+00:00] kernel.INFO: I am a happy log entry 3 | [2021-03-09T12:37:10+01:00] kernel.WARNING: Oops! 4 | [2021-03-09T12:37:10-01:00] kernel.ERROR: Oh snap, something went wrong. 5 | 6 | [ISO 8601 compliance (Y-m-d\TH:i:sO)] 7 | [2021-03-09T12:38:49+0000] kernel.INFO: I am a happy log entry 8 | [2021-03-09T12:38:49+1000] kernel.WARNING: Oops! 9 | [2021-03-09T12:38:49-1000] kernel.ERROR: Oh snap, something went wrong. 10 | 11 | [RFC 3339 compliance (Y-m-d\TH:i:sP)] 12 | [2021-03-09T06:39:46+00:00] kernel.INFO: I am a happy log entry 13 | [2021-03-09T06:39:46+01:00] kernel.WARNING: Oops! 14 | [2021-03-09T06:39:46-01:00] kernel.ERROR: Oh snap, something went wrong. 15 | 16 | [RFC 339 EXTENDED compliance (Y-m-d\TH:i:s.vP)] 17 | [2021-03-09T12:40:29.539+00:00] kernel.INFO: I am a happy log entry 18 | [2021-03-09T12:40:29.539+00:00] kernel.WARNING: Oops! 19 | [2021-03-09T12:40:29.539+00:00] kernel.ERROR: Oh snap, something went wrong. 20 | 21 | [Non-standard compliance (without timezone) (Y-m-d H:i:s), (Y-d-m H:i:s)] 22 | [2021-03-09 12:45:24] kernel.INFO: I am a happy log entry 23 | [2021-09-03 12:45:24] kernel.WARNING: Oops! 24 | [2021-09-03 12:45:24] kernel.ERROR: Oh snap, something went wrong. 25 | 26 | [Issue #10: Stacktrace break format] 27 | [2023-06-16T08:40:12.289166+00:00] messenger.WARNING: Error thrown while handling message App\Message\TestQueue 28 | [stacktrace] 29 | #0 /app/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php(71): Symfony\\Component\\Messenger\\Middleware\HandleMessageMiddleware 30 | #1 /app/vendor/symfony/doctrine-bridge/Messenger/Something.php(33): Symfony\\Component\\Messenger\\Middleware\BlahBlah 31 | #2 /app/vendor/symfony/doctrine-bridge/Messenger/Nothing.php(33): Symfony\\Component\\Messenger\\Middleware\Blah 32 | #3 /app/vendor/symfony/doctrine-bridge/Messenger/Everything.php(33): Symfony\\Component\\Messenger\\Middleware\Foo 33 | #4 /app/vendor/symfony/doctrine-bridge/Messenger/Middleware.php(33): Symfony\\Component\\Messenger\\Middleware\Bar 34 | #5 /app/vendor/symfony/messenger/Messenger/Bus.php(33): Symfony\\Component\\Messenger\\Middleware\Lorem 35 | #6 /app/vendor/symfony/messenger/Messenger/OtherBus.php(33): Symfony\\Component\\Messenger\\Middleware\Ipsum 36 | #7 /app/vendor/symfony/messenger/Messenger/MoreBuses.php(33): Symfony\\Component\\Messenger\\Middleware\BlahBlah 37 | #8 /app/vendor/symfony/console/Messenger/SubCommand.php(33): Symfony\\Component\\Messenger\\Middleware\BlahBlah 38 | #9 /app/vendor/symfony/console/Messenger/MasterCommand.php(33): Symfony\\Component\\Messenger\\Middleware\BlahBlah 39 | #10 /app/vendor/symfony/console/AbstractCommand.php(33): Symfony\\Component\\Messenger\\Middleware\Nope 40 | #11 /app/vendor/symfony/framework/Application.php(33): Symfony\\Component\\Messenger\\Middleware\BlahBla 41 | [2021-03-09T12:38:49+0000] kernel.DEBUG: Executing statement: INSERT INTO messenger_messages (body, headers, queue_name, created_at, available_at) VALUES(?, ?, ?, ?, ?) 42 | [2021-03-09 12:45:24] eventbus.INFO: Exception logged successfully to all listeners 43 | [2021-03-09T12:38:49-1000] kernel.ERROR: Terminating app 44 | -------------------------------------------------------------------------------- /ideologSymfonyFormat.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 7 10 | 11 | -------------------------------------------------------------------------------- /ideolog_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dszczer/ideolog-symfony-format/827da6b135d5f52bf6f57e71614dbe334561098c/ideolog_settings.png -------------------------------------------------------------------------------- /regex_test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dszczer/ideolog-symfony-format/827da6b135d5f52bf6f57e71614dbe334561098c/regex_test.jpg --------------------------------------------------------------------------------