Skip to content

Commit

Permalink
Merge pull request #111 from scoutapp/log-configuration-details-on-st…
Browse files Browse the repository at this point in the history
…artup

Added additional debug logging to show connectivity details
  • Loading branch information
Chris Schneider authored Nov 12, 2019
2 parents c0e3618 + eafea07 commit 0550fef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Changed

- Added more debug logging to isolate issues easier (#111)

## [1.0.0] 2019-11-05

### Changed
Expand Down
18 changes: 15 additions & 3 deletions src/Agent.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,17 @@ public static function fromConfig(Config $config, ?LoggerInterface $logger = nul

public function connect() : void
{
if (! $this->connector->connected() && $this->enabled()) {
$this->logger->info('Scout Core Agent Connection Failed, attempting to start');
if (! $this->enabled()) {
$this->logger->debug('Connection skipped, since monitoring is disabled');

return;
}

if (! $this->connector->connected()) {
$this->logger->info(sprintf(
'Scout Core Agent (app=%s) not connected yet, attempting to start',
$this->config->get(ConfigKey::APPLICATION_NAME)
));
$manager = new AutomaticDownloadAndLaunchManager(
$this->config,
$this->logger,
Expand All @@ -157,7 +166,10 @@ public function connect() : void
$this->logger->warning($failedToConnect->getMessage());
}
} else {
$this->logger->debug('Scout Core Agent Connected');
$this->logger->debug(sprintf(
'Scout Core Agent Connected (app=%s)',
$this->config->get(ConfigKey::APPLICATION_NAME)
));
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/AgentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function testLogMessagesAreLoggedWhenUsingDefaultConfiguration() : void
->method('log')
->with(
LogLevel::DEBUG,
self::stringContains('Scout Core Agent Connected'),
self::stringContains('Connection skipped, since monitoring is disabled'),
[]
);

Expand Down

0 comments on commit 0550fef

Please sign in to comment.