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
Almost everyBuildTask I see and every one I write, there is a need to output some information to the screen in a PHP SAPI specific way. This inevitably means that a developer writes a method similar to the following.
/**
*
* @param string $message
* @param int $numLines
*/
public static function out(string $message, int $numLines = 1)
{
$newLine = Director::is_cli() ? PHP_EOL : '<br/>';
echo $message . str_repeat($newLine, $numLines);
}
There is of course DB::alteration_message() but this is pretty crude, uses repeated message "type" definitions for each SAPI and makes no account of platform ("\n" is hard-coded rather than using an O/S independent marker such as is provided by PHP_EOL) nor does it provide the ability to use a custom LoggerInterface implementation to e.g. colourise the screen o.p. (See LoggerInterface() in silverstripe/assetsFileMigrationHelper for yet another way to achieve this).
This proposal therefore seeks the implementation of a flexible method on BuildTask for logging to the screen (But makes no objection if something even more flexible such as logging to a remote F/S is do-able, providing it is no more complicated than restricting the work to o/p only to the screen).
Steps to Reproduce
Write a BuildTask and try really hard not to need to write a method as described above.
The text was updated successfully, but these errors were encountered:
Affected Version
All.
Description
Almost every
BuildTask
I see and every one I write, there is a need to output some information to the screen in a PHP SAPI specific way. This inevitably means that a developer writes a method similar to the following.There is of course
DB::alteration_message()
but this is pretty crude, uses repeated message "type" definitions for each SAPI and makes no account of platform ("\n" is hard-coded rather than using an O/S independent marker such as is provided byPHP_EOL
) nor does it provide the ability to use a customLoggerInterface
implementation to e.g. colourise the screen o.p. (SeeLoggerInterface()
insilverstripe/assets
FileMigrationHelper
for yet another way to achieve this).This proposal therefore seeks the implementation of a flexible method on
BuildTask
for logging to the screen (But makes no objection if something even more flexible such as logging to a remote F/S is do-able, providing it is no more complicated than restricting the work to o/p only to the screen).Steps to Reproduce
Write a
BuildTask
and try really hard not to need to write a method as described above.The text was updated successfully, but these errors were encountered: