Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Log op arguments along with class FQN
Browse files Browse the repository at this point in the history
  • Loading branch information
adiachenko committed Aug 22, 2019
1 parent b299e07 commit e12186f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
11 changes: 9 additions & 2 deletions src/Events/FeatureStarted.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ class FeatureStarted
*/
public $name;

/**
* @var array
*/
public $arguments;

/**
* FeatureStarted constructor.
* @param string $name
* @param array $arguments
*/
public function __construct($name)
public function __construct($name, array $arguments = [])
{
$this->name = $name;
$this->arguments = $arguments;
}
}
}
11 changes: 9 additions & 2 deletions src/Events/JobStarted.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ class JobStarted
*/
public $name;

/**
* @var array
*/
public $arguments;

/**
* JobStarted constructor.
* @param string $name
* @param array $arguments
*/
public function __construct($name)
public function __construct($name, array $arguments = [])
{
$this->name = $name;
$this->arguments = $arguments;
}
}
}
11 changes: 9 additions & 2 deletions src/Events/OperationStarted.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ class OperationStarted
*/
public $name;

/**
* @var array
*/
public $arguments;

/**
* OperationStarted constructor.
* @param string $name
* @param array $arguments
*/
public function __construct($name)
public function __construct($name, array $arguments = [])
{
$this->name = $name;
$this->arguments = $arguments;
}
}
}
4 changes: 2 additions & 2 deletions src/JobDispatcherTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public function run($job, $arguments = [], $extra = [])
}

if ($job instanceof Operation) {
event(new OperationStarted(get_class($job)));
event(new OperationStarted(get_class($job), $arguments));
}
if ($job instanceof Job) {
event(new JobStarted(get_class($job)));
event(new JobStarted(get_class($job), $arguments));
}

$result = $this->dispatch($job, $arguments);
Expand Down
2 changes: 1 addition & 1 deletion src/ServesFeaturesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ trait ServesFeaturesTrait
*/
public function serve($feature, $arguments = [])
{
event(new FeatureStarted($feature));
event(new FeatureStarted($feature, $arguments));

return $this->dispatch($this->marshal($feature, new Collection(), $arguments));
}
Expand Down

0 comments on commit e12186f

Please sign in to comment.