Skip to content

Commit

Permalink
Cleanup, PHP 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
leowebguy committed Mar 24, 2023
1 parent 39d85ff commit f845e26
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to this project will be documented in this file.

## 1.0.2 - 2023.03.23
Cleanup, PHP 8.2

## 1.0.1 - 2023.01.27
Implemented a better way to to filter non-critical expections using `NotFoundHttpException`

Expand Down
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"report",
"monolog"
],
"version": "1.0.1",
"version": "1.0.2",
"type": "craft-plugin",
"license": "MIT",
"minimum-stability": "dev",
Expand Down Expand Up @@ -39,8 +39,6 @@
"extra": {
"name": "Simple Logger",
"handle": "simple-logger",
"hasCpSection": false,
"hasCpSettings": false,
"class": "leowebguy\\simplelogger\\SimpleLogger"
},
"config": {
Expand Down
7 changes: 0 additions & 7 deletions src/SimpleLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public function init()
'loggerService' => LoggerService::class
]);


Event::on(
ErrorHandler::class,
ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION,
Expand Down Expand Up @@ -90,9 +89,6 @@ function(ExceptionEvent $event) {
}
);

/**
* Plugin templates
*/
Event::on(
View::class,
View::EVENT_REGISTER_CP_TEMPLATE_ROOTS,
Expand All @@ -101,9 +97,6 @@ static function(RegisterTemplateRootsEvent $event) {
}
);

/**
* Log info
*/
Craft::info(
'Simple Logger plugin loaded',
__METHOD__
Expand Down
10 changes: 5 additions & 5 deletions src/services/LoggerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ public function writeException($data): void
{
$path = Craft::$app->path->getLogPath();

$logfile = '/simplelogger.json';
$logfile = 'simplelogger.json';

if (!@file_exists($path . $logfile)) {
@file_put_contents($path . $logfile, '[]');
if (!@file_exists($path . '/' . $logfile)) {
@file_put_contents($path . '/' . $logfile, '[]');
}

$json = @file_get_contents($path . $logfile);
$json = @file_get_contents($path . '/' . $logfile);

$array = Json::decode($json);
$array[] = $data;
@file_put_contents($path . $logfile, Json::encode($array));
@file_put_contents($path . '/' . $logfile, Json::encode($array));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/templates/email.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<thead>
<tr>
<td>{{ 'time'|t }}</td>
<td>{{ 'code'|t }}</td>
{# <td>{{ 'code'|t }}</td> #}
<td>{{ 'level_name'|t }}</td>
<td>{{ 'sourcetype'|t }}</td>
<td>{{ 'message'|t }}</td>
Expand All @@ -31,7 +31,7 @@
{% for log in logs %}
<tr>
<td>{{ log.time }}</td>
<td>{{ log.code }}</td>
{# <td>{{ log.code }}</td> #}
<td>{{ log.level_name }}</td>
<td>{{ log.sourcetype }}</td>
<td>{{ log.message }}</td>
Expand Down

0 comments on commit f845e26

Please sign in to comment.