No Yii2::debug() shown in the Codecept -vvv output
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- php
- Domain
- testing-qa
Research direction
Start with src/Codeception/Lib/Connector/Yii2/Logger.php and its level check, then inspect how codecept run -vv, -vvv, and --debug determine logging verbosity. The change is complete when Yii2 debug output appears at the intended verbosity without unexpectedly increasing normal output for existing users.
Written by the indexing model from the issue text.
Description
What are you trying to achieve?
I would like to see the Yii2::debug() output in the codecept run -vvv <filename> output.
What do you get instead?
Only the Yii::info, Yii::warning and Yii::error outputs are shown.
Provide console output if related. Use
-vvvmode for more details.
[application] 'Info: Testing info Output in Codecept'
[application] 'Warning: Testing Warning Output in Codecept'
[application] 'Error: Testing Error Output in Codecept'
Provide test source code if related
\Yii::trace("Trace: Testing Trace in Codecept");
\Yii::debug("Debug: Testing Debugging in Codecept");
\Yii::info("Info: Testing info Output in Codecept");
\Yii::warning("Warning: Testing Warning Output in Codecept");
\Yii::error("Error: Testing Error Output in Codecept");
Details
- PHP Version: Tested with v7.4
- Operating System: Linux
- Installation type: Composer
- Suite configuration:
class_name: UnitTester
modules:
enabled:
- Asserts
- Filesystem
- Yii2:
part: [orm, email]
The issue can be resolved if I directly edit vendor/codeception/base/src/Codeception/Lib/Connector/Yii2/Logger.php and in the levels check
if (!in_array($level, [
\yii\log\Logger::LEVEL_INFO,
\yii\log\Logger::LEVEL_WARNING,
\yii\log\Logger::LEVEL_ERROR,
])) {
return;
}
I add in \yii\log\Logger::LEVEL_TRACE,
I suspect it's not in there because by default it would be rather verbose.
Changing it now could also overwhelm existing users.
The reason I would like it in there is because when I'm debugging an issue and using Unit Tests to do so, it's nicer to use Yii::debug() for getting the information I need. I've spent ages setting up a unit test for a specific scenario only to find there's some edge case I need more info on to investigate.
However I'm currently forced to use \Yii::info() to output that information and that is also output in the web debugger and in our staging environment log files and breaks the semantics of debug versus info
Ideally the Trace level would ONLY be included if -vvv (3x verbosity) was used and not -vv (2x verbosity) or if --debug.
However I'm not sure how to test that when the Logger->log() method is being called, so whilst I can submit a pull request simply adding the extra level, I suspect that's not ideal for existing users who might not want the extra verbosity.
Alternatively if someone can point out how I can specify my own logger so I can fork the existing one (or use container definitions to remap to my own)? Or allow it to only show if there's a config entry, like as part of the Yii2 module .yml, then that would be ideal.
- Dominant language
- PHP
- Stars
- 19
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Codeception/module-yii2
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Codeception/module-yii2#145 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Codeception/module-yii2#144 · 1 comment · 1 reaction ·
-
MongoDB support Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
Codeception/module-yii2#142 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
Codeception/module-yii2#141 · 1 comment ·
-
Codeception/module-yii2#134 · 4 comments · 1 assignee ·
All issues in Codeception/module-yii2
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·