2 namespace Consolidation\Log;
4 use Symfony\Component\Console\Style\SymfonyStyle;
5 use Symfony\Component\Console\Input\StringInput;
6 use Symfony\Component\Console\Output\OutputInterface;
9 * Style log messages with Symfony\Component\Console\Style\SymfonyStyle.
10 * No context variable styling is done.
12 * This is the appropriate styler to use if your desire is to replace
13 * the use of SymfonyStyle with a Psr-3 logger without changing the
14 * appearance of your application's output.
16 class SymfonyLogOutputStyler implements LogOutputStylerInterface
18 public function defaultStyles()
23 public function style($context)
28 public function createOutputWrapper(OutputInterface $output)
30 // SymfonyStyle & c. contain both input and output functions,
31 // but we only need the output methods here. Create a stand-in
32 // input object to satisfy the SymfonyStyle constructor.
33 return new SymfonyStyle(new StringInput(''), $output);
36 public function log($symfonyStyle, $level, $message, $context)
38 $symfonyStyle->text($message);
41 public function success($symfonyStyle, $level, $message, $context)
43 $symfonyStyle->success($message);
46 public function error($symfonyStyle, $level, $message, $context)
48 $symfonyStyle->error($message);
51 public function warning($symfonyStyle, $level, $message, $context)
53 $symfonyStyle->warning($message);
56 public function note($symfonyStyle, $level, $message, $context)
58 $symfonyStyle->note($message);
61 public function caution($symfonyStyle, $level, $message, $context)
63 $symfonyStyle->caution($message);