mirror of
https://github.com/standardebooks/web.git
synced 2025-07-15 02:46:46 -04:00
Add newsletter management functionality
This commit is contained in:
parent
90ee0a93c9
commit
b0197d189a
57 changed files with 1017 additions and 143 deletions
|
@ -3,18 +3,27 @@ use function Safe\fopen;
|
|||
use function Safe\fwrite;
|
||||
use function Safe\fclose;
|
||||
use function Safe\error_log;
|
||||
use function Safe\gmdate;
|
||||
|
||||
class Logger{
|
||||
public static function WritePostmarkWebhookLogEntry(string $requestId, string $text): void{
|
||||
self::WriteLogEntry(POSTMARK_WEBHOOK_LOG_FILE_PATH, $requestId . "\t" . $text);
|
||||
}
|
||||
|
||||
public static function WriteGithubWebhookLogEntry(string $requestId, string $text): void{
|
||||
self::WriteLogEntry(GITHUB_WEBHOOK_LOG_FILE_PATH, $requestId . "\t" . $text);
|
||||
}
|
||||
|
||||
public static function WriteLogEntry(string $file, string $text): void{
|
||||
try{
|
||||
$fp = fopen(GITHUB_WEBHOOK_LOG_FILE_PATH, 'a+');
|
||||
$fp = fopen($file, 'a+');
|
||||
}
|
||||
catch(\Exception $ex){
|
||||
self::WriteErrorLogEntry('Couldn\'t open log file: ' . GITHUB_WEBHOOK_LOG_FILE_PATH . '. Exception: ' . vds($ex));
|
||||
self::WriteErrorLogEntry('Couldn\'t open log file: ' . $file . '. Exception: ' . vds($ex));
|
||||
return;
|
||||
}
|
||||
|
||||
fwrite($fp, gmdate('Y-m-d H:i:s') . "\t" . $requestId . "\t" . $text . "\n");
|
||||
fwrite($fp, gmdate('Y-m-d H:i:s') . "\t" . $text . "\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue