Interface LaravelUi5\Sdk\Audit\Contracts\BusinessLogInterface

The business log — what happened in a run, business-wise, also when nothing changed: a budget check that warns, an import that skipped what it could not take, a refusal the business made.

Write from an action's handler, an audited job or an audited command; inject the interface in the constructor. The message is a key with its arguments in your module's bundle (MessageText::of('budget.exceeded', [110])->from(MyApp::NAMESPACE)), never prose — it is read in the reader's language. Name the object it is about as $subject.

Who, when, from where and under which correlation key come from the run itself; you pass none of it. A message written inside the run's transaction is stored once the transaction ends, whichever way, and records whether it went through — so a rollback keeps the message that explains it.

public function __construct(private readonly BusinessLogInterface $log) {}

public function handle(BusinessTransaction $transaction, BusinessContextInterface $context, SdkContext $sdk): ActionResponse
{
    $this->log->warning(MessageText::of('budget.exceeded', [$percent])->from(TimesheetApp::NAMESPACE), $project);
    …
}
  • LaravelUi5\Sdk\Audit\Contracts\BusinessLogInterface
    • LaravelUi5\Sdk\Audit\BusinessLog implements BusinessLogInterface
Methods