-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ITKDev: Added drush command to send line into audit log
- Loading branch information
Showing
11 changed files
with
179 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
modules/os2forms_audit/src/Commands/AuditLogDrushCommands.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Drupal\os2forms_audit\Commands; | ||
|
||
use Drupal\os2forms_audit\Service\Logger; | ||
use Drush\Commands\DrushCommands; | ||
|
||
/** | ||
* Simple command to send log message into audit log. | ||
*/ | ||
class AuditLogDrushCommands extends DrushCommands { | ||
|
||
/** | ||
* Os2FormsAuditDrushCommands constructor. | ||
* | ||
* @param \Drupal\os2forms_audit\Service\Logger $auditLogger | ||
* Audit logger service. | ||
*/ | ||
public function __construct( | ||
protected readonly Logger $auditLogger | ||
) { | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Log a test message to the os2forms_audit logger. | ||
* | ||
* @param string $log_message | ||
* Message to be logged. | ||
* | ||
* @command os2forms_audit:log | ||
* @usage os2forms_audit:log 'This is a test message.' | ||
* Logs 'This is a test message.' to the os2forms_audit logger. | ||
* | ||
* @throws \Drupal\Component\Plugin\Exception\PluginException | ||
*/ | ||
public function logMessage(string $log_message = ''): void { | ||
$this->auditLogger->log(time(), $log_message, []); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.