Skip to content

Commit

Permalink
Merge branch '5.x' into 6.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
angrybrad committed Jun 12, 2024
2 parents 3e95e3a + 6bb9a9d commit ea10ab3
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 181 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Fixed an error that would occur when running a feed with the backup database setting enabled, when Craft's `backupCommand` was set to false. ([#1461](https://github.com/craftcms/feed-me/pull/1461))
- Logs now use the default log component, and are stored in the database. [#1344](https://github.com/craftcms/feed-me/issues/1344)

## 6.1.0 - 2024-05-26

Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,33 @@ composer require craftcms/feed-me
./craft plugin/install feed-me
```

## Customizing Logs

As of version `5.6`/`6.2`, logging is handled by Craft's log component and stored in the database instead of the filesystem.
If you want them logged to files (or anywhere else), you can add your own log target in your `config/app.php` file:

```php
return [
'components' => [
'log' => [
'monologTargetConfig' => [
// optionally, omit from Craft's default logs
'except' => ['feed-me'],
],

// add your own log target to write logs to file
'targets' => [
[
'class' => \yii\log\FileTarget::class,
'logFile' => '@storage/logs/feed-me.log',
'categories' => ['feed-me'],
],
],
],
],
];
```

## Resources

- **[Feed Me Plugin Page](https://plugins.craftcms.com/feed-me)** – The official plugin page for Feed Me
Expand Down
14 changes: 14 additions & 0 deletions src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,24 @@ protected function createTables(): void
'dateUpdated' => $this->dateTime()->notNull(),
'uid' => $this->uid(),
]);

// @see \craft\feedme\migrations\m240611_134740_create_logs_table
$this->createTable('{{%feedme_logs}}', [
'id' => $this->bigPrimaryKey(),
'level' => $this->integer(),
'category' => $this->string(),
'log_time' => $this->double(),
'prefix' => $this->text(),
'message' => $this->text(),
]);

$this->createIndex('idx_log_level', '{{%feedme_logs}}', 'level');
$this->createIndex('idx_log_category', '{{%feedme_logs}}', 'category');
}

protected function removeTables(): void
{
$this->dropTableIfExists('{{%feedme_feeds}}');
$this->dropTableIfExists('{{%feedme_logs}}');
}
}
42 changes: 42 additions & 0 deletions src/migrations/m240611_134740_create_logs_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace craft\feedme\migrations;

use craft\db\Migration;

/**
* m240611_134740_create_logs_table migration.
*/
class m240611_134740_create_logs_table extends Migration
{
/**
* @inheritdoc
*/
public function safeUp(): bool
{
// @see \craft\feedme\migrations\m240611_134740_create_logs_table
$this->createTable('{{%feedme_logs}}', [
'id' => $this->bigPrimaryKey(),
'level' => $this->integer(),
'category' => $this->string(),
'log_time' => $this->double(),
'prefix' => $this->text(),
'message' => $this->text(),
]);

$this->createIndex('idx_log_level', '{{%feedme_logs}}', 'level');
$this->createIndex('idx_log_category', '{{%feedme_logs}}', 'category');

return true;
}

/**
* @inheritdoc
*/
public function safeDown(): bool
{
$this->dropTableIfExists('{{%feedme_logs}}');

return true;
}
}
Loading

0 comments on commit ea10ab3

Please sign in to comment.