Ejemplo n.º 1
0
    }
    return true;
};
$out->setHandlers($outHandlers);
/**
 * Handler for output from the VM.
 *
 * @param $vm The VM that called us
 * @param $output Output from the vm.
 * @uses $out The Challenge UI
 */
$vmHandlers['output'] = function ($vm, $output) use($out) {
    $out->addOutput($output);
    global $__CLIOPTS;
    if (isset($__CLIOPTS['log'])) {
        file_put_contents(getFilepath($__CLIOPTS['log'], 'logs'), chr($output), FILE_APPEND | LOCK_EX);
    }
};
/**
 * Handler for Traces from the VM.
 *
 * @param $vm The VM that called us
 * @param $loc The current location of the vm
 * @param $op The SynacorOP being executed
 * @param $data The array of data being passed to the op
 * @param $breaking Are we breaking here?
 * @uses $out The Challenge UI
 */
$vmHandlers['trace'] = function ($vm, $loc, $op, $data, $breaking) use($out) {
    if ($out->tracing()) {
        if (is_array($data)) {
 /**
  * Add some output to the trace panel.
  *
  * @param $output Line of output to add to trace.
  */
 public function addTrace($output)
 {
     $this->traceData[] = $output;
     if (!$this->traceOnOutput) {
         $this->update();
     }
     global $__CLIOPTS;
     if (isset($__CLIOPTS['trace'])) {
         file_put_contents(getFilepath($__CLIOPTS['trace'], 'logs'), $output . "\n", FILE_APPEND | LOCK_EX);
     }
 }
Ejemplo n.º 3
0
 /**
  * Add trace output.
  *
  * @param $output Line of output to add to trace.
  */
 public function addTrace($output)
 {
     echo '{-- TRACE: ', $output, ' --}', "\n";
     global $__CLIOPTS;
     if (isset($__CLIOPTS['trace'])) {
         file_put_contents(getFilepath($__CLIOPTS['trace'], 'logs'), $output . "\n", FILE_APPEND | LOCK_EX);
     }
 }