Skip to content

Commit

Permalink
Do not log by default (#1472)
Browse files Browse the repository at this point in the history
In the light of #1430 it doesn't make sense to keep Infection suggesting logging at all times. Keeping old behavior will mean that Infection will use 66% more memory where it could not.
  • Loading branch information
sanmai committed Jan 22, 2021
1 parent 2c4804c commit edfe1bd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
20 changes: 14 additions & 6 deletions src/Config/ValueProvider/TextLogFileProvider.php
Expand Up @@ -45,8 +45,6 @@
*/
final class TextLogFileProvider
{
public const TEXT_LOG_FILE_NAME = 'infection.log';

private ConsoleHelper $consoleHelper;
private QuestionHelper $questionHelper;

Expand All @@ -59,22 +57,32 @@ public function __construct(ConsoleHelper $consoleHelper, QuestionHelper $questi
/**
* @param string[] $dirsInCurrentDir
*/
public function get(IO $io, array $dirsInCurrentDir): string
public function get(IO $io, array $dirsInCurrentDir): ?string
{
$io->writeln(['']);

$io->writeln([
'',
'Infection may save execution results in a text log for a future review.',
'This can be "infection.log" but we recommend leaving it out for performance reasons.',
'Press <comment><return></comment> to skip additional logging.',
'',
]);

$questionText = $this->consoleHelper->getQuestion(
'Where do you want to store the text log file?',
self::TEXT_LOG_FILE_NAME
''
);

$question = new Question($questionText, self::TEXT_LOG_FILE_NAME);
$question = new Question($questionText, '');
$question->setAutocompleterValues($dirsInCurrentDir);

return $this->questionHelper->ask(
$answer = $this->questionHelper->ask(
$io->getInput(),
$io->getOutput(),
$question
);

return $answer === '' ? null : $answer;
}
}
13 changes: 0 additions & 13 deletions tests/e2e/Configure/infection.json.dist

This file was deleted.

3 changes: 0 additions & 3 deletions tests/e2e/Configure/infection.json.test
Expand Up @@ -4,9 +4,6 @@
"src"
]
},
"logs": {
"text": "infection.log"
},
"mutators": {
"@default": true
}
Expand Down
Expand Up @@ -67,7 +67,7 @@ public function test_it_uses_default_value(): void
[]
);

$this->assertSame(TextLogFileProvider::TEXT_LOG_FILE_NAME, $textLogFilePath);
$this->assertNull($textLogFilePath);
}

public function test_it_uses_typed_value(): void
Expand Down

0 comments on commit edfe1bd

Please sign in to comment.