examples/file_storage/models/TaskRunFile.php
public function saveTaskRun()
    {
        //if monolog not found does nothing
        if (!class_exists('Monolog\Logger')) {
            return false;
        }
        $logger = new Logger('cron_logger');
        $logger->pushHandler(new RotatingFileHandler($this->logs_folder . $this->log_name));
        $task = TaskFile::taskGet($this->task_id);
        if (self::RUN_STATUS_STARTED == $this->status) {
            $message = 'task ' . $task->getCommand() . ' just started';
        } else {
            $message = 'task ' . $task->getCommand() . ' ended with status ' . $this->status
                . ', execution time ' . $this->execution_time . ', output: ' . PHP_EOL . $this->output;
        }
        return $logger->addNotice($message);
    }
public function saveTaskRun()
    {
        //if monolog not found does nothing
        if (!class_exists('Monolog\Logger')) {
            return false;
        }
        $logger = new Logger('cron_logger');
        $logger->pushHandler(new RotatingFileHandler($this->logs_folder . $this->log_name));
        $task = TaskFile::taskGet($this->task_id);
        if (self::RUN_STATUS_STARTED == $this->status) {
            $message = 'task ' . $task->getCommand() . ' just started';
        } else {
            $message = 'task ' . $task->getCommand() . ' ended with status ' . $this->status
                . ', execution time ' . $this->execution_time . ', output: ' . PHP_EOL . $this->output;
        }
        return $logger->addNotice($message);
    }
public function saveTaskRun ( ) { //if monolog not found does nothing if ( ! class_exists ( 'Monolog\Logger' ) ) { return false ; } $ logger = new Logger ( 'cron_logger' ) ; $ logger -> pushHandler ( new RotatingFileHandler ( $ this -> logs_folder . $ this -> log_name ) ) ; $ task = TaskFile :: taskGet ( $ this -> task_id ) ; if ( self :: RUN_STATUS_STARTED == $ this -> status ) { $ message = 'task ' . $ task -> getCommand ( ) . ' just started' ; } else { $ message = 'task ' . $ task -> getCommand ( ) . ' ended with status ' . $ this -> status . ', execution time ' . $ this -> execution_time . ', output: ' . PHP_EOL . $ this -> output ; } return $ logger -> addNotice ( $ message ) ; }
Writes log in file. Do NOT actually saves the task run
@return bool
Writes log in file . Do NOT actually saves the task run