Browse Source

:art: Add mobile.log file to diagnose mobile issues https://github.com/siyuan-note/siyuan/issues/10270

Daniel 1 year ago
parent
commit
8c5f8d2bc4
5 changed files with 15 additions and 4 deletions
  1. 1 1
      kernel/go.mod
  2. 2 2
      kernel/go.sum
  3. 4 0
      kernel/mobile/kernel.go
  4. 8 0
      kernel/model/export.go
  5. 0 1
      kernel/util/working_mobile.go

+ 1 - 1
kernel/go.mod

@@ -54,7 +54,7 @@ require (
 	github.com/siyuan-note/dejavu v0.0.0-20240124091649-941e2960dc74
 	github.com/siyuan-note/dejavu v0.0.0-20240124091649-941e2960dc74
 	github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4
 	github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4
 	github.com/siyuan-note/eventbus v0.0.0-20240124091459-8e1b37a55255
 	github.com/siyuan-note/eventbus v0.0.0-20240124091459-8e1b37a55255
-	github.com/siyuan-note/filelock v0.0.0-20240121150730-38e4487651d1
+	github.com/siyuan-note/filelock v0.0.0-20240128062546-4cf460a2732a
 	github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690
 	github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690
 	github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0
 	github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0
 	github.com/siyuan-note/riff v0.0.0-20231226152006-8833f8b9a6c1
 	github.com/siyuan-note/riff v0.0.0-20231226152006-8833f8b9a6c1

+ 2 - 2
kernel/go.sum

@@ -358,8 +358,8 @@ github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4 h1:kJaw5L/e
 github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4/go.mod h1:UYcCCY+0wh+GmUoDOaO63j1sV5lgy7laLAk1XhEiUis=
 github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4/go.mod h1:UYcCCY+0wh+GmUoDOaO63j1sV5lgy7laLAk1XhEiUis=
 github.com/siyuan-note/eventbus v0.0.0-20240124091459-8e1b37a55255 h1:WTAUBlU2v7ISet9ankbjqZrRKo6MLGK1LBmDyNlehPY=
 github.com/siyuan-note/eventbus v0.0.0-20240124091459-8e1b37a55255 h1:WTAUBlU2v7ISet9ankbjqZrRKo6MLGK1LBmDyNlehPY=
 github.com/siyuan-note/eventbus v0.0.0-20240124091459-8e1b37a55255/go.mod h1:1/nGgthl89FPA7GzAcEWKl6zRRnfgyTjzLZj9bW7kuw=
 github.com/siyuan-note/eventbus v0.0.0-20240124091459-8e1b37a55255/go.mod h1:1/nGgthl89FPA7GzAcEWKl6zRRnfgyTjzLZj9bW7kuw=
-github.com/siyuan-note/filelock v0.0.0-20240121150730-38e4487651d1 h1:eNHKiqE5yPnj1PYk0PJhxP+oqWdKi+0ZI28lBQmz5qg=
-github.com/siyuan-note/filelock v0.0.0-20240121150730-38e4487651d1/go.mod h1:CYJQjSyKYLhEJJC+5I+R4uNcpyW0X2CaUYwMVbkelDk=
+github.com/siyuan-note/filelock v0.0.0-20240128062546-4cf460a2732a h1:77b+pJn6eb905MMGKynV/OJBzSkNfh96QUnpzgT7v18=
+github.com/siyuan-note/filelock v0.0.0-20240128062546-4cf460a2732a/go.mod h1:CYJQjSyKYLhEJJC+5I+R4uNcpyW0X2CaUYwMVbkelDk=
 github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690 h1:r7qWSaYQhomCAdQl/dZe4NdAn1zadytb4jcOeopdHw4=
 github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690 h1:r7qWSaYQhomCAdQl/dZe4NdAn1zadytb4jcOeopdHw4=
 github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690/go.mod h1:ZWp+cGHwkXXCIYudLUxI9AV2IcbsgPGhQVL/1SqUxQg=
 github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690/go.mod h1:ZWp+cGHwkXXCIYudLUxI9AV2IcbsgPGhQVL/1SqUxQg=
 github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0 h1:+XjUr9UMXsczdO2bGA72p/k9wa2ShPb8ybi7CDBJ7HQ=
 github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0 h1:+XjUr9UMXsczdO2bGA72p/k9wa2ShPb8ybi7CDBJ7HQ=

+ 4 - 0
kernel/mobile/kernel.go

@@ -84,6 +84,10 @@ func SetHttpServerPort(port int) {
 	filelock.AndroidServerPort = port
 	filelock.AndroidServerPort = port
 }
 }
 
 
+func GetCurrentWorkspacePath() string {
+	return util.WorkspaceDir
+}
+
 func SetTimezone(container, appDir, timezoneID string) {
 func SetTimezone(container, appDir, timezoneID string) {
 	if "ios" == container {
 	if "ios" == container {
 		os.Setenv("ZONEINFO", filepath.Join(appDir, "app", "zoneinfo.zip"))
 		os.Setenv("ZONEINFO", filepath.Join(appDir, "app", "zoneinfo.zip"))

+ 8 - 0
kernel/model/export.go

@@ -328,6 +328,14 @@ func ExportSystemLog() (zipPath string) {
 		}
 		}
 	}
 	}
 
 
+	mobileLog := filepath.Join(util.TempDir, "mobile.log")
+	if gulu.File.IsExist(mobileLog) {
+		to := filepath.Join(exportFolder, "mobile.log")
+		if err := filelock.Copy(mobileLog, to); nil != err {
+			logging.LogErrorf("copy mobile log from [%s] to [%s] failed: %s", err, mobileLog, to)
+		}
+	}
+
 	zipPath = exportFolder + ".zip"
 	zipPath = exportFolder + ".zip"
 	zip, err := gulu.Zip.Create(zipPath)
 	zip, err := gulu.Zip.Create(zipPath)
 	if nil != err {
 	if nil != err {

+ 0 - 1
kernel/util/working_mobile.go

@@ -50,7 +50,6 @@ func BootMobile(container, appDir, workspaceBaseDir, lang string) {
 			logging.LogErrorf("create user home conf folder [%s] failed: %s", userHomeConfDir, err)
 			logging.LogErrorf("create user home conf folder [%s] failed: %s", userHomeConfDir, err)
 			os.Exit(logging.ExitCodeInitWorkspaceErr)
 			os.Exit(logging.ExitCodeInitWorkspaceErr)
 		}
 		}
-
 	}
 	}
 
 
 	defaultWorkspaceDir := filepath.Join(workspaceBaseDir, "siyuan")
 	defaultWorkspaceDir := filepath.Join(workspaceBaseDir, "siyuan")