Add git hash and version name
[rtmpclient.git] / app / src / main / java / ai / suanzi / rtmpclient / LogUtil.java
index 9018d9d..a547c9c 100644 (file)
@@ -44,7 +44,6 @@ public class LogUtil {
     public static void config(File dir) {
         try {
             final LogConfigurator logConfigurator = new LogConfigurator();
-            //String fname = getExternalFilesDir(null) + File.separator + "log.txt";
             DIR = dir;
             logFile = dir + File.separator + FILE_NAME;
             logConfigurator.setFileName(logFile);
@@ -54,7 +53,9 @@ public class LogUtil {
             logConfigurator.configure();
             gLogger = Logger.getLogger("LogUtil");
             gLogger.error("#######################################");
-            gLogger.error("RtmpClient by suanzi.ai");
+            gLogger.error("RtmpClient for Android by suanzi.ai  ");
+            gLogger.error("Git Revision: " + BuildConfig.GIT_REVISION);
+            gLogger.error("Version : " + BuildConfig.VERSION_NAME);
             gLogger.debug("Log file is located at: " + logFile);
 
         } catch (Exception e){
@@ -63,6 +64,7 @@ public class LogUtil {
         }
     }
 
+
     public static void sendLogs (){
 
         AsyncTask<Void, Integer, Boolean> mailTask = new AsyncTask<Void, Integer, Boolean>() {
@@ -73,7 +75,6 @@ public class LogUtil {
             @Override
             protected Boolean doInBackground(Void... voids) {
 
-                // zip log.txt to log.zip
                 String[] s = new String[1];
                 s[0] = logFile;
                 gLogger.debug("zipLog - " + zfile);
@@ -103,9 +104,6 @@ public class LogUtil {
 
     }
 
-
-
-
     private static final String SMTP_SERVER = "smtp.exmail.qq.com";
     private static final String USER = "support@suanzi.ai";
     private static final String SENT_MAIL = "support@suanzi.ai";
@@ -115,7 +113,7 @@ public class LogUtil {
     private static boolean sendMail(String attachment){
 
         String account = UserInfo.user;
-        String macAddr = UserInfo.macAddr;
+        String subject = UserInfo.macAddr + " - " + BuildConfig.VERSION_NAME + " - " + BuildConfig.GIT_REVISION;
         StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
         StrictMode.setThreadPolicy(policy);
 
@@ -135,7 +133,7 @@ public class LogUtil {
         try {
             message.setFrom(new InternetAddress(SENT_MAIL, account, "UTF-8"));
             message.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(RECV_MAIL, "support", "UTF-8"));
-            message.setSubject(macAddr, "UTF-8");
+            message.setSubject(subject, "UTF-8");
             //message.setContent("hahaha", "text/html;charset=UTF-8");
             message.setSentDate(new Date());