Jsahleen has uploaded a new change for review.
https://gerrit.wikimedia.org/r/159362
Change subject: Logging: Add logging to JsonDict.js
......................................................................
Logging: Add logging to JsonDict.js
* Changed one message in ContentTranslationService.js
Change-Id: Ifd5f95039483d2be2349c8b95b8e34a8b783c29b
---
M ContentTranslationService.js
M dictionary/jsondict/JsonDict.js
2 files changed, 16 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver
refs/changes/62/159362/1
diff --git a/ContentTranslationService.js b/ContentTranslationService.js
index 7997b32..72a0346 100644
--- a/ContentTranslationService.js
+++ b/ContentTranslationService.js
@@ -157,7 +157,7 @@
dictClient.getTranslations( word, from, to ).then(
function ( data ) {
res.send( data );
- logger.debug( 'Dictionary translations sent' );
+ logger.debug( 'Dictionary information sent' );
},
function ( error ) {
res.send( 500, {
diff --git a/dictionary/jsondict/JsonDict.js b/dictionary/jsondict/JsonDict.js
index 7f0ae9d..2b71547 100644
--- a/dictionary/jsondict/JsonDict.js
+++ b/dictionary/jsondict/JsonDict.js
@@ -1,6 +1,7 @@
var dictRegistry = require( __dirname + '/JsonDictRegistry.json' ),
fs = require( 'fs' ),
- Q = require( 'q' );
+ Q = require( 'q' ),
+ logger = require( __dirname + '/../../utils/Logger.js' );
/**
* Find bilingual dictionaries for the language pair
@@ -46,6 +47,7 @@
dictionaries = findDictionaries( sourceLang, targetLang );
if ( dictionaries === null ) {
+ logger.info( 'JSON dictionary not found for ' + sourceLang +
'-' + targetLang );
deferred.resolve( [] );
return deferred.promise;
}
@@ -61,6 +63,7 @@
var results, result, i, len,
translations = [];
if ( err ) {
+ logger.info( 'Dictionary file could not be read: (' +
err + ')' );
deferred.reject( 'Error: ' + err );
return;
}
@@ -68,12 +71,19 @@
for ( i = 0, len = results.length; i < len; i++ ) {
result = results[i];
translations.push( {
- 'phrase': result[0],
- 'info': result[1],
- 'sources': [dictionaryId]
+ phrase: result[0],
+ info: result[1],
+ sources: [ dictionaryId ]
} );
}
- deferred.resolve( { 'source': source, 'translations':
translations } );
+
+ if ( translations.length < 1 ) {
+ logger.debug( 'No dictionary translations found' );
+ } else {
+ logger.debug( 'Dictionary translations found' );
+ }
+
+ deferred.resolve( { source: source, translations: translations
} );
} );
return deferred.promise;
}
--
To view, visit https://gerrit.wikimedia.org/r/159362
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifd5f95039483d2be2349c8b95b8e34a8b783c29b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Jsahleen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits