You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 -vvv mode 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");
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.
The text was updated successfully, but these errors were encountered:
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.
Details
The issue can be resolved if I directly edit vendor/codeception/base/src/Codeception/Lib/Connector/Yii2/Logger.php and in the levels check
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.
The text was updated successfully, but these errors were encountered: