-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from driftphp/feature/using-console-bridge
Using console bridge for messages
- Loading branch information
Showing
9 changed files
with
229 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the DriftPHP Project | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drift\Bus\Console; | ||
|
||
use Drift\Console\OutputPrinter; | ||
|
||
/** | ||
* Class ConsumerHeaderMessage. | ||
*/ | ||
final class ConsumerHeaderMessage | ||
{ | ||
private $elapsedTime; | ||
private $message; | ||
|
||
/** | ||
* ConsumerMessage constructor. | ||
* | ||
* @param string $elapsedTime | ||
* @param string $message | ||
*/ | ||
public function __construct( | ||
string $elapsedTime, | ||
string $message | ||
) { | ||
$this->elapsedTime = $elapsedTime; | ||
$this->message = $message; | ||
} | ||
|
||
/** | ||
* Print. | ||
* | ||
* @param OutputPrinter $outputPrinter | ||
*/ | ||
public function print(OutputPrinter $outputPrinter) | ||
{ | ||
$color = '32'; | ||
|
||
$outputPrinter->print("\033[01;{$color}mCONSM\033[0m "); | ||
$outputPrinter->print("(\e[00;37m".$this->elapsedTime.' | '.((int) (memory_get_usage() / 1000000))." MB\e[0m)"); | ||
$outputPrinter->print(" {$this->message}"); | ||
$outputPrinter->printLine(); | ||
} | ||
} |
Oops, something went wrong.