Stores to STDIN of any process, specified by a command.

Usage example:


$log = new Logger('myLogger');
$log->pushHandler(new ProcessHandler('/usr/bin/php /var/www/monolog/someScript.php'));

CloneableInstantiable
ExtendsMonolog\Handler\AbstractProcessingHandler
Monolog\Handler\AbstractHandler
Monolog\Handler\Handler
ImplementsMonolog\Handler\FormattableHandlerInterface
Monolog\Handler\HandlerInterface
Monolog\Handler\ProcessableHandlerInterface
Monolog\ResettableInterface
Methods
public __construct(string $command, $level = 100, bool $bubble = true, ?string $cwd = NULL)
 


  • throws InvalidArgumentException
public Monolog\Handler\Handler::__destruct()
public Monolog\Handler\Handler::__sleep()
public close() : void
 
{@inheritdoc}

public Monolog\Handler\AbstractHandler::getBubble() : bool
 
Gets the bubbling behavior.

  • return bool true means that this handler allows bubbling. false means that bubbling is not permitted.
public Monolog\Handler\AbstractProcessingHandler::getFormatter() : Monolog\Formatter\FormatterInterface
 
{@inheritdoc}

public Monolog\Handler\AbstractHandler::getLevel() : int
 
Gets minimum logging level at which this handler will be triggered.

  • return int
public Monolog\Handler\AbstractProcessingHandler::handle(array $record) : bool
 
{@inheritdoc}

public Monolog\Handler\Handler::handleBatch(array $records) : void
 
{@inheritdoc}

public Monolog\Handler\AbstractHandler::isHandling(array $record) : bool
 
{@inheritdoc}

public Monolog\Handler\AbstractProcessingHandler::popProcessor() : callable
 
{@inheritdoc}

public Monolog\Handler\AbstractProcessingHandler::pushProcessor(callable $callback) : Monolog\Handler\HandlerInterface
 
{@inheritdoc}

  • suppress PhanTypeMismatchReturn
public Monolog\Handler\AbstractProcessingHandler::reset()
public Monolog\Handler\AbstractHandler::setBubble(bool $bubble) : self
 
Sets the bubbling behavior.

  • return self
public Monolog\Handler\AbstractProcessingHandler::setFormatter(Monolog\Formatter\FormatterInterface $formatter) : Monolog\Handler\HandlerInterface
 
{@inheritdoc}

  • suppress PhanTypeMismatchReturn
public Monolog\Handler\AbstractHandler::setLevel( $level) : self
 
Sets minimum logging level at which this handler will be triggered.

  • return self
Constants
protected Monolog\Handler\ProcessHandler::DESCRIPTOR_SPEC = [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']]
 


  • var array
Properties
protected Monolog\Handler\AbstractHandler::$bubble
protected Monolog\Handler\AbstractProcessingHandler::$formatter
 


  • var FormatterInterface
protected Monolog\Handler\AbstractHandler::$level
protected Monolog\Handler\AbstractProcessingHandler::$processors
 


  • var callable[]
Methods
protected Monolog\Handler\AbstractProcessingHandler::getDefaultFormatter() : Monolog\Formatter\FormatterInterface
 
Gets the default formatter.

Overwrite this if the LineFormatter is not a good default for your handler.

protected Monolog\Handler\AbstractProcessingHandler::processRecord(array $record) : array
 
Processes a record.

protected readProcessErrors() : string
 
Reads the errors of the process, if there are any.

  • codeCoverageIgnore
  • return string Empty string if there are no errors.
protected Monolog\Handler\AbstractProcessingHandler::resetProcessors() : void
protected selectErrorStream()
 
Selects the STDERR stream.

  • return int|bool
protected write(array $record) : void
 
Writes the record down to the log of the implementing handler

  • throws UnexpectedValueException
protected writeProcessInput(string $string) : void
 
Writes to the input stream of the opened process.

  • codeCoverageIgnore
Properties
private $command
 


  • var string
private $cwd
 


  • var string|null
private $pipes
 


  • var array
private $process
 
Holds the process to receive data on its STDIN.

  • var resource|bool|null
Methods
private ensureProcessIsStarted() : void
 
Makes sure that the process is actually started, and if not, starts it, assigns the stream pipes, and handles startup errors, if any.

private handleStartupErrors() : void
 
Selects the STDERR stream, handles upcoming startup errors, and throws an exception, if any.

  • throws UnexpectedValueException
private startProcess() : void
 
Starts the actual process and sets all streams to non-blocking.

© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only