mdemori's avatar

disable stderr message log and all logging during testing

There is a way to disable loggin message on stderr during testing ?

Inside some function I've logging message like below:

use Illuminate\Support\Facades\Log;

Log::stack(['status_verify_log', 'stderr'])
                ->info(
                    date('[Y-m-d H:i:s]')
                    . '   - verified correctly'
                );

unfortunately during test, all messages appear on cli, so I need to disable only during tests. I already try this solution but seem that don't work :(

$app = Log::getFacadeRoot();
        Log::shouldReceive(
            'error',
            'warning',
            'debug',
            'info',
            'notice',
            'critical',
            'alert',
            'emergency',
            'stack',
            'stderr',
        );
        Log::swap($app);
0 likes
0 replies

Please or to participate in this conversation.