This repository was archived by the owner on Jan 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create contributing.md and an issue template for bug reports
- Loading branch information
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help improve PuPHPeteer | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**Reproducible example** | ||
```php | ||
// Provide a full example reproducing the bug | ||
``` | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Generated logs** | ||
Provide the logs generated by your example, see how to get them in the guidelines for contributing to this repository: | ||
https://github.com/nesk/puphpeteer/blob/master/.github/contributing.md#provide-logs-with-your-bug-report | ||
|
||
``` | ||
The generated logs | ||
``` | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Environment (please complete the following information):** | ||
- OS: [e.g. Windows 10, macOS 10.13.2, Ubuntu 18.04] | ||
- Node version: [e.g. 10.4.0] | ||
- PHP version [e.g. 7.2.6] | ||
|
||
My Node package manager is: | ||
- [x] NPM (specify the version) | ||
- [ ] Yarn (specify the version) | ||
- [ ] Other (specify the name and version) | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Contributing to PuPHPeteer | ||
|
||
## Provide logs with your bug report | ||
|
||
Bug reports should contain logs generated by your reproducible example. To get them you must provide a logger to your PuPHPeteer instance. Say you have the following code in your bug report: | ||
|
||
```php | ||
use Nesk\Puphpeteer\Puppeteer; | ||
|
||
$puppeteer = new Puppeteer; | ||
$browser = $puppeteer->launch(); | ||
$browser->newPage()->goto('https://example.com'); | ||
$browser->close(); | ||
``` | ||
|
||
Require Monolog with Composer: | ||
|
||
```shell | ||
composer require monolog/monolog | ||
``` | ||
|
||
And provide a Monolog instance to the `Puppeteer` constructor: | ||
|
||
```diff | ||
use Nesk\Puphpeteer\Puppeteer; | ||
|
||
- $puppeteer = new Puppeteer; | ||
+ $logPath = 'path/to/your.log'; | ||
+ | ||
+ $logger = new \Monolog\Logger('PuPHPeteer'); | ||
+ $logger->pushHandler(new \Monolog\Handler\StreamHandler($logPath, \Monolog\Logger::DEBUG)); | ||
+ | ||
+ $puppeteer = new Puppeteer(['logger' => $logger]); | ||
$browser = $puppeteer->launch(); | ||
$browser->newPage()->goto('https://example.com'); | ||
$browser->close(); | ||
``` | ||
|
||
Execute your code and `path/to/your.log` will contain the generated logs, here's an example of what you can get and provide in your bug report: | ||
|
||
``` | ||
[2018-06-07 12:41:19] PuPHPeteer.DEBUG: [options] {"read_timeout":35,"logger":{}} [] [] | ||
[2018-06-07 12:41:19] PuPHPeteer.DEBUG: Starting process... [] [] | ||
[2018-06-07 12:41:19] PuPHPeteer.DEBUG: [PID 15547] Process started [] [] | ||
[2018-06-07 12:41:20] PuPHPeteer.DEBUG: [PORT 61118] [sending] {"type":"call","name":"launch","catched":false,"value":[]} [] [] | ||
[2018-06-07 12:41:20] PuPHPeteer.DEBUG: [PORT 61118] [receiving] {"__rialto_resource__":true,"class_name":"Browser","id":"1528375280340.2676"} [] [] | ||
``` |