I'm working with cron jobs in laravel and I'm a bit confused about how to log stuff from within my scripts.
Of course I can save the 'system output' like so
x x x x x php /pathto/artisan schedule:run >> /someath/storage/somelog.log 2>&1
but that doesn't include stuff I want to output from the scripts. I think I know how to output to the general laravel (daily, fx) log. But I don't want to mix it up with errors and stuff.
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
class SomeClass {
private $customLog;
function __construct() {
$this->customLog = new Logger('Log Name');
$this->customLog->pushHandler(new StreamHandler(storage_path('logs/custom.log'), Logger::INFO));
}
// elsewhere in class...
$this->customLog->error('Some error message');
$this->customLog->warning('a warning');