Skip to content

job-runner/psr-log-adapter

Repository files navigation

psr/log for JobRunner

Build Status Type Coverage Type Coverage Latest Stable Version License

This package provides a psr-log adapter for JobRunner.

Installation

composer require job-runner/psr-log-adapter

Usage

<?php

declare(strict_types=1);

use JobRunner\JobRunner\Job\CliJob;
use JobRunner\JobRunner\Job\JobList;
use JobRunner\JobRunner\CronJobRunner;
use JobRunner\JobRunner\PsrLog\PsrLogEventListener;

require 'vendor/autoload.php';


$myLogger = new \Psr\Log\NullLogger();
$jobList = new JobList();
$jobList->push(new CliJob('php ' . __DIR__ . '/tutu.php', '* * * * *'));

CronJobRunner::create()->withEventListener(new PsrLogEventListener($myLogger));->run($jobList);