Skip to content

Commit

Permalink
v0.3.10
Browse files Browse the repository at this point in the history
- add improvements for Journal with logs
  • Loading branch information
ewilan-riviere committed Feb 14, 2024
1 parent 3ec4278 commit bd57f77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kiwilan/notifier-laravel",
"description": "Notifier for Laravel is a package to send notifications and monitoring, built for Discord, Slack and mails.",
"version": "0.3.0",
"version": "0.3.10",
"keywords": [
"laravel",
"notifier",
Expand Down
11 changes: 8 additions & 3 deletions src/Journal.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public function __construct(
if (is_string($data)) {
$this->data = [$data];
}
if (empty($this->message)) {
$this->message = 'Empty message';
}
$this->log();
}

Expand Down Expand Up @@ -92,10 +95,12 @@ private function log(): void
Log::log($this->level, $this->message, $this->data);
if (config('notifier.journal.use_error_log')) {
$data = json_encode($this->data, JSON_PRETTY_PRINT);
error_log("Journal: {$this->level} - {$this->message} - {$data}");
$message = "Journal: {$this->level} - {$this->message}";
if ($data) {
$message .= "\n{$data}";
}
error_log($message);
}

// dump($this->message, $this->data);
}

/**
Expand Down

0 comments on commit bd57f77

Please sign in to comment.