You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2021/05/26 19:22:02 UTC

[echarts-bot] 02/02: chore: log to file when failed to translate.

This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-bot.git

commit db7a01f176892a214041bbf769610a4f9aed636a
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Thu May 27 03:21:21 2021 +0800

    chore: log to file when failed to translate.
---
 src/translator.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/translator.js b/src/translator.js
index 4eca28c..67384db 100644
--- a/src/translator.js
+++ b/src/translator.js
@@ -1,6 +1,7 @@
 const googleTranslate = require('@plainheart/google-translate-api');
-const { translate: bingTranslate } = require('bing-translate-api')
+const { translate: bingTranslate } = require('bing-translate-api');
 const franc = require('franc-min');
+const logger = require('./logger');
 
 async function translateByGoogle(rawContent) {
     try {
@@ -20,7 +21,8 @@ async function translateByGoogle(rawContent) {
         };
     }
     catch (e) {
-        console.error('failed to translate by google', e);
+        logger.error('failed to translate by google');
+        logger.error(e);
     }
 }
 
@@ -34,7 +36,8 @@ async function translateByBing(rawContent) {
         };
     }
     catch (e) {
-        console.error('failed to translate by bing', e);
+        logger.error('failed to translate by bing');
+        logger.error(e);
     }
 }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org