Update the progress bar.

@param int $percent From 1-100.
@param string $msg The message.
@return void Echo's output
@throws coding_exception
490921
private function _update($percent, $msg) {
        if (empty($this->time_start)) {
            throw new coding_exception('You must call create() (or use the $autostart ' .
                    'argument to the constructor) before you try updating the progress bar.');
        }

        if (CLI_SCRIPT) {
            return; // Temporary solution for cli scripts.
        }

        $estimate = $this->estimate($percent);

        if ($estimate === null) {
            // Always do the first and last updates.
        } else if ($estimate == 0) {
            // Always do the last updates.
        } else if ($this->lastupdate + 20 < time()) {
            // We must update otherwise browser would time out.
        } else if (round($this->percent, 2) === round($percent, 2)) {
            // No significant change, no need to update anything.
            return;
        }

        $estimatemsg = null;
        if (is_numeric($estimate)) {
            $estimatemsg = get_string('secondsleft', 'moodle', round($estimate, 2));
        }

        $this->percent = round($percent, 2);
        $this->lastupdate = microtime(true);

        echo html_writer::script(js_writer::function_call('updateProgressBar',
            array($this->html_id, $this->percent, $msg, $estimatemsg)));
        flush();
    }
962843
protected function drawProgressBar($current, $label)
    {
        $percentage = $this->percentageFormatted($current / $this->total);

        if ($this->shouldRedraw($percentage, $label)) {
            $progress_bar = $this->getProgressBar($current, $label);
            $this->output->write($this->parser->apply($progress_bar));
        }

        $this->current_percentage = $percentage;
    }
52040
public function info($msg) {
		$this->mailMessage(self::LEVEL_INFO, $msg);

		if($this->checkLevel($this->loglevels, self::LEVEL_INFO) !== true)
			return;

		$this->writeMessage(self::LEVEL_INFO, $msg);
	}
1016871
public function serverStopProcess($msg = null)
  {
    TeamSpeak3_Helper_Signal::getInstance()->emit("notifyServershutdown", $this);

    $this->execute("serverprocessstop", array("reasonmsg" => $msg));
  }
258423
public function addError(string $msg, string ...$args): void
    {
        $this->errors[] = sprintf($msg, ...$args);
    }
339904
public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $text)
    {
        //lastWrittenPercent and lastWrittenTime are used to prevent performance issues if
        //many progresses are written. (the filesystem access at nfs can slow that down)
        //we just update the progressbar if the percentage increases and
        //the last request was at least 500ms ago
        if (!$this->_lastWrittenPercent) {
            $this->_lastWrittenPercent = (int)($percent*100);
        }
        if (!$this->_lastWrittenTime) {
            $this->_lastWrittenTime = microtime(true);
        }
        if ($this->_lastWrittenPercent < (int)($percent*100)
            && $this->_lastWrittenTime+0.5 <= microtime(true)) {
            $arguments = array(
                'current'       => $current,
                'max'           => $max,
                'percent'       => ($percent * 100),
                'timeTaken'     => $timeTaken,
                'timeRemaining' => $timeRemaining,
                'text'          => $text,
                'finished'      => false
            );
            $this->_saveStatus($arguments);
            $this->_lastWrittenPercent = (int)($percent*100);
            $this->_lastWrittenTime = microtime(true);
        }
    }
1157592
public void append(String msg) {
        verifySystemOut();
        PrintStream printStream = out;
        try {
            if (userInputActive && !appendCalled) {
                printStream.print(moveDownToSkipPrompt());
                appendCalled = true;
            }
            if (msg.endsWith(LINE_SEPARATOR)) {
                printStream.print(msg);
            } else {
                printStream.println(msg);
            }
            cursorMove = 0;
        } finally {
            progressIndicatorActive = false;
        }
    }
427979
def progress(count, total, suffix=''):
    '''
    
    '''
    bar_len = 60
    filled_len = int(round(bar_len * count / float(total)))
    percents = round(100.0 * count / float(total), 1)
    bar = '=' * filled_len + '-' * (bar_len - filled_len)
    sys.stdout.write('[%s] %s%s %s\r' % (bar, percents, '%', suffix))
    sys.stdout.flush()
342505
public function execute(AMQPMessage $msg)
    {
        echo str_repeat('-', 60).PHP_EOL;

        echo '[RECV ' . date('c') . ']' . PHP_EOL .'<content>' .
            PHP_EOL . $msg->body . PHP_EOL . '</content>'.PHP_EOL.PHP_EOL;

        echo "*" . ' INFO ' . PHP_EOL;
        foreach ($msg->{'delivery_info'} as $key => $value) {
            if (is_scalar($value)) {
                echo "** " . $key . ' = ' . $value . PHP_EOL;
            }
        }
        echo "*" . ' PROPERTIES ' . PHP_EOL;
        foreach ($msg->get_properties() as $property => $value) {
            if (is_scalar($value)) {
                echo "** " . $property . ' = ' . $value . PHP_EOL;
            }
        }
    }
984226
public function progressBarCommand(): void
    {
        $i     = 0;
        $total = 120;
        $bar   = new ProgressBar();
        $bar->start(120);

        while ($i <= $total) {
            $bar->advance();
            usleep(50000);
            $i++;
        }

        $bar->finish();
    }
219435
def update(self, percent=None, text=None):
        
        if percent is not None:
            self.percent = percent
        if text is not None:
            self.message = text
        super().update()
1197802
public function max($limit, $msg)
    {
        if(strlen($this->_value) > 0 && (float)$this->_value > (float)$limit) {
            $this->_errors[] = $msg;
        }
        return $this;
    }
137803
protected function SetError($msg) {
    $this->error_count++;
    if (($this->Mailer == 'smtp') and ($this->smtp !== null)) {
      $lasterror = $this->smtp->getError();
      if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
        $msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
      }
    }
    $this->ErrorInfo = $msg;
  }
691988
protected function setError(string $msg)
    {
        $this->error = $msg;
        $lastError = error_get_last();
        if ($lastError !== null) {
            $this->errorDetail = sprintf(
                "'%s' in %s on line %s",
                $lastError['message'],
                $lastError['file'],
                $lastError['line']
            );
        }
    }
1281209
public function stdout($msg, $status = self::STATUS_OK)
    {
        $msg = $this->removeColors($msg);
        $msg = $this->replaceEOLs($msg);

        if (defined('STDOUT')) {
            fwrite(STDOUT, $msg);
        } else {
            echo $msg;
            if (count(\ob_get_status()) !== 0) {
                ob_flush();
            }
        }
        return $this;
    }
1002354
public static function addDebugHexa($msg, $bin)
	{
		if(self::$debug)
			self::$debugData .= self::makePrintable($msg) . ": " .
				self::strToHex($bin) . "\n";
	}
523643
public function update_progress() {
        global $DB;
        $now = $this->get_time();
        $lastprogress = $this->lastprogresstime != 0 ? $this->lastprogresstime : $now;

        $progressrecord = new \stdClass();
        $progressrecord->id = $this->recordid;
        $progressrecord->{$this->field} = '';

        // Update database with progress.
        if ($now > $this->nextupdate) {  // Limit database updates based on time.
            list ($min, $max) = $this->get_progress_proportion_range();

            $progressrecord->{$this->field} = $min;
            $DB->update_record($this->table, $progressrecord);
            $this->nextupdate = $lastprogress + $this->interval;
        }

        // Set progress to 1 (100%) when there are no more progress updates.
        // Their is no guarantee that the final update from the get progress method
        // will be 1 even for a successful process. So we explicitly set the final DB
        // value to 1 when we are no longer in progress.
        if (!$this->is_in_progress_section()) {
            $progressrecord->{$this->field} = 1;
            $DB->update_record($this->table, $progressrecord);
        }
    }