summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/src/Jobs/GenericTranslateJob.php')
-rw-r--r--MLEB/Translate/src/Jobs/GenericTranslateJob.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/MLEB/Translate/src/Jobs/GenericTranslateJob.php b/MLEB/Translate/src/Jobs/GenericTranslateJob.php
index a74677a7..91d1b294 100644
--- a/MLEB/Translate/src/Jobs/GenericTranslateJob.php
+++ b/MLEB/Translate/src/Jobs/GenericTranslateJob.php
@@ -7,8 +7,9 @@
* @license GPL-2.0-or-later
*/
-namespace MediaWiki\Extensions\Translate\Jobs;
+namespace MediaWiki\Extension\Translate\Jobs;
+use Job;
use MediaWiki\Logger\LoggerFactory;
use Psr\Log\LoggerInterface;
@@ -16,7 +17,7 @@ use Psr\Log\LoggerInterface;
* Generic Job class extended by other jobs. Provides logging functionality.
* @since 2019.08
*/
-abstract class GenericTranslateJob extends \Job {
+abstract class GenericTranslateJob extends Job {
/**
* A logger instance
* @var LoggerInterface
@@ -43,9 +44,15 @@ abstract class GenericTranslateJob extends \Job {
return $this->logger;
}
- protected function getLogPrefix() {
- return '[Job: ' . $this->getType() . '][Request ID: ' . $this->getRequestId() .
- '][Title: ' . $this->title->getPrefixedText() . '] ';
+ protected function getLogPrefix(): string {
+ $prefix = $this->getType();
+ if ( isset( $this->title ) ) {
+ $prefix .= ' [' . $this->title->getPrefixedText() . ']';
+ }
+
+ // Add a separator at the end.
+ $prefix .= ': ';
+ return $prefix;
}
protected function logInfo( $msg, $context = [] ) {
@@ -64,3 +71,5 @@ abstract class GenericTranslateJob extends \Job {
$this->getLogger()->warning( $this->getLogPrefix() . $msg, $context );
}
}
+
+class_alias( GenericTranslateJob::class, '\MediaWiki\Extensions\Translate\GenericTranslateJob' );