Skip to content

Commit

Permalink
Merge pull request #8 from Jhnbrn90/compat-monolog-3
Browse files Browse the repository at this point in the history
Use expected \Monolog\LogRecord object in handler
  • Loading branch information
nvanheuverzwijn authored Feb 21, 2023
2 parents cb7e573 + b9fdba1 commit e285634
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Monolog/Handler/LogdnaHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ public function __construct($ingestion_key, $hostname, $level = \Monolog\Logger:
}

/**
* @param array $record
* @param \Monolog\LogRecord $record
*/
protected function write(array $record): void {
protected function write(\Monolog\LogRecord $record): void {
$headers = ['Content-Type: application/json'];
$data = $record["formatted"];
$data = $record->formatted;

$url = \sprintf("https://logs.logdna.com/logs/ingest?hostname=%s&mac=%s&ip=%s&now=%s", $this->hostname, $this->mac, $this->ip, $record['datetime']->getTimestamp());
$url = \sprintf("https://logs.logdna.com/logs/ingest?hostname=%s&mac=%s&ip=%s&now=%s", $this->hostname, $this->mac, $this->ip, $record->datetime->getTimestamp());

\curl_setopt($this->curl_handle, CURLOPT_URL, $url);
\curl_setopt($this->curl_handle, CURLOPT_USERPWD, "$this->ingestion_key:");
Expand Down

0 comments on commit e285634

Please sign in to comment.