class LoggingBeginner

Same name in this branch
  1. 11.x core/modules/package_manager/tests/modules/package_manager_bypass/src/LoggingBeginner.php \Drupal\package_manager_bypass\LoggingBeginner

Logs Composer Stager's Beginner process output to a file.

@internal This is an internal part of Package Manager and may be changed or removed at any time without warning. External code should not interact with this class.

Hierarchy

Expanded class hierarchy of LoggingBeginner

2 files declare their use of LoggingBeginner
LoggingBeginnerTest.php in core/modules/package_manager/tests/src/Unit/LoggingBeginnerTest.php
ServicesTest.php in core/modules/package_manager/tests/src/Kernel/ServicesTest.php

File

core/modules/package_manager/src/LoggingBeginner.php, line 24

Namespace

Drupal\package_manager
View source
final class LoggingBeginner implements BeginnerInterface {
    public function __construct(BeginnerInterface $decorated, ConfigFactoryInterface $configFactory, TimeInterface $time) {
    }
    
    /**
     * {@inheritdoc}
     */
    public function begin(PathInterface $activeDir, PathInterface $stagingDir, ?PathListInterface $exclusions = NULL, ?OutputCallbackInterface $callback = NULL, int $timeout = ProcessInterface::DEFAULT_TIMEOUT) : void {
        $path = $this->configFactory
            ->get('package_manager.settings')
            ->get('log');
        if ($path) {
            $callback = new FileProcessOutputCallback($path, $callback);
            $callback(OutputTypeEnum::OUT, sprintf("### Beginning in %s\n", $stagingDir->absolute()));
        }
        $start_time = $this->time
            ->getCurrentMicroTime();
        $this->decorated
            ->begin($activeDir, $stagingDir, $exclusions, $callback, $timeout);
        $end_time = $this->time
            ->getCurrentMicroTime();
        if ($callback) {
            $callback(OutputTypeEnum::OUT, sprintf("### Finished in %0.3f seconds\n", $end_time - $start_time));
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary
LoggingBeginner::begin public function
LoggingBeginner::__construct public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.