From fde3067d6fab5e00bc08cb77da971799fb70e3cd Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 5 Jan 2023 15:49:06 +0800 Subject: [PATCH 1/7] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=90=8C=E6=97=B6=E6=89=93=E5=BC=80=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4=20https://github.?= =?UTF-8?q?com/siyuan-note/siyuan/issues/4567?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/appearance/langs/en_US.json | 2 +- app/appearance/langs/es_ES.json | 2 +- app/appearance/langs/fr_FR.json | 2 +- app/appearance/langs/zh_CHT.json | 2 +- app/appearance/langs/zh_CN.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index a1a29e937..9caecda82 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -746,7 +746,7 @@ "about5": "Access Authorization Code", "about6": "After configuration, it will be used as the access authentication password, leave it blank to close the authentication", "about7": "Workspace dir", - "about8": "After the workspace is switched, the data in the current workspace will not be copied to the target workspace
If you need to copy data, please manually copy the current workspace data folder on the file system to the target workspace
The application will be closed automatically after modification, please restart manually", + "about8": "After the workspace is switched, the data in the current workspace will not be copied to the target workspace
The application will be closed automatically after modification, please restart manually", "about9": "Automatically upload error messages and diagnostic data", "about10": "After enabling, it will automatically upload error information and diagnostic data through the Sentry SDK, which does not involve personal privacy data so that developers can fix bugs. The application will be closed automatically after modification, please restart manually", "about11": "Network serving", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 7167b3f2e..5ab34fe0c 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -746,7 +746,7 @@ "about5": "Código de autorización de acceso", "about6": "Después de la configuración, se utilizará como contraseña de autenticación de acceso, déjelo en blanco para cerrar la autenticación", "about7": "Directorio del espacio de trabajo", - "about8": "Después de cambiar el espacio de trabajo, los datos del espacio de trabajo actual no se copiarán en el espacio de trabajo de destino
Si necesita copiar datos, copie manualmente la carpeta data del espacio de trabajo actual en el sistema de archivos al espacio de trabajo de destino
La aplicación se cerrará automáticamente después de la modificación, por favor reinicie manualmente", + "about8": "Después de cambiar el espacio de trabajo, los datos del espacio de trabajo actual no se copiarán en el espacio de trabajo de destino
La aplicación se cerrará automáticamente después de la modificación, por favor reinicie manualmente", "about9": "Carga automática de mensajes de error y datos de diagnóstico", "about10": "Después de habilitarlo, cargará automáticamente información de error y datos de diagnóstico a través del Sentry SDK, que no involucra datos de privacidad personal para que los desarrolladores puede corregir errores. La aplicación se cerrará automáticamente después de la modificación, por favor, reinicie manualmente", "about11": "Red de servicio", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 09dbc7a8a..ba80a6bc5 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -746,7 +746,7 @@ "about5": "Accès Code d'autorisation", "about6": "Configuré comme mot de passe d'authentification d'accès, laisser vide pour désactiver l'authentification.", "about7": "Répertoire de l'espace de travail", - "about8": "Une fois l'espace de travail basculé, les données de l'espace de travail actuel ne seront pas copiées dans l'espace de travail cible
Si vous devez copier des données, veuillez copier manuellement le dossier data de l'espace de travail actuel sur le système de fichiers vers l'espace de travail cible
L'application se fermera automatiquement après modification, merci de redémarrer manuellement", + "about8": "Une fois l'espace de travail basculé, les données de l'espace de travail actuel ne seront pas copiées dans l'espace de travail cible
L'application se fermera automatiquement après modification, merci de redémarrer manuellement", "about9": "Télécharger automatiquement les messages d'erreur et les données de diagnostic", "about10": "Après l'activation, il télécharge automatiquement les informations d'erreur et les données de diagnostic via le SDK Sentry, qui n'implique pas de données de confidentialité personnelles afin que les développeurs peut corriger des bogues. L'application sera fermée automatiquement après modification, veuillez la redémarrer manuellement.", "about11": "Service de réseau", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 4ff17cf94..659416283 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -746,7 +746,7 @@ "about5": "存取授權碼", "about6": "配置後作為存取鑒權密碼,留空則關閉鑒權", "about7": "工作空間目錄", - "about8": "切換工作空間後不會將當前工作空間的數據複製到目標工作空間中
如果需要復制數據,請手動在文件系統上將當前工作空間 data 文件夾拷貝到目標工作空間下
修改後會自動關閉應用,請手動重啟", + "about8": "切換工作空間後不會將當前工作空間的數據複製到目標工作空間中
修改後會自動關閉應用,請手動重啟", "about9": "自動上傳報錯信息和診斷數據", "about10": "啟用後會通過 Sentry SDK 自動上傳報錯信息和診斷數據等不涉及個人隱私的數據,以便開發者修復缺陷。修改後會自動關閉應用,請手動重啟", "about11": "網路伺服", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index e311d5dd9..5cad64e79 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -746,7 +746,7 @@ "about5": "访问授权码", "about6": "配置后作为访问鉴权密码,留空则关闭鉴权", "about7": "工作空间目录", - "about8": "切换工作空间后不会将当前工作空间的数据复制到目标工作空间中
如果需要复制数据,请手动在文件系统上将当前工作空间 data 文件夹拷贝到目标工作空间下
修改后会自动关闭应用,请手动重启", + "about8": "切换工作空间后不会将当前工作空间的数据复制到目标工作空间中
修改后会自动关闭应用,请手动重启", "about9": "自动上传报错信息和诊断数据", "about10": "启用后会通过 Sentry SDK 自动上传报错信息和诊断数据等不涉及个人隐私的数据,以便开发者修复缺陷。修改后会自动关闭应用,请手动重启", "about11": "网络伺服", From fbb1fee4860fe409195f2798a1bd28700046bfb1 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 5 Jan 2023 16:00:05 +0800 Subject: [PATCH 2/7] =?UTF-8?q?:art:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=20https://github.com/siyuan-note/siyuan/issues/4642?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/router.go | 2 ++ kernel/api/workspace.go | 69 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/kernel/api/router.go b/kernel/api/router.go index f1052b81a..b854a1ddc 100644 --- a/kernel/api/router.go +++ b/kernel/api/router.go @@ -46,6 +46,8 @@ func ServeAPI(ginServer *gin.Engine) { ginServer.Handle("POST", "/api/system/setNetworkProxy", model.CheckAuth, setNetworkProxy) ginServer.Handle("POST", "/api/system/setWorkspaceDir", model.CheckAuth, setWorkspaceDir) ginServer.Handle("POST", "/api/system/listWorkspaceDirs", model.CheckAuth, listWorkspaceDirs) + ginServer.Handle("POST", "/api/system/createWorkspaceDir", model.CheckAuth, createWorkspaceDir) + ginServer.Handle("POST", "/api/system/removeWorkspaceDir", model.CheckAuth, removeWorkspaceDir) ginServer.Handle("POST", "/api/system/setAppearanceMode", model.CheckAuth, setAppearanceMode) ginServer.Handle("POST", "/api/system/getSysFonts", model.CheckAuth, getSysFonts) ginServer.Handle("POST", "/api/system/exit", model.CheckAuth, exit) diff --git a/kernel/api/workspace.go b/kernel/api/workspace.go index 7078536e2..8def3b3ce 100644 --- a/kernel/api/workspace.go +++ b/kernel/api/workspace.go @@ -30,6 +30,75 @@ import ( "github.com/siyuan-note/siyuan/kernel/util" ) +func createWorkspaceDir(c *gin.Context) { + ret := gulu.Ret.NewResult() + defer c.JSON(http.StatusOK, ret) + + arg, ok := util.JsonArg(c, ret) + if !ok { + return + } + + path := arg["path"].(string) + if gulu.File.IsExist(path) { + ret.Code = -1 + ret.Msg = model.Conf.Language(78) + return + } + + if err := os.MkdirAll(path, 0755); nil != err { + ret.Code = -1 + ret.Msg = fmt.Sprintf("create workspace dir [%s] failed: %s", path, err) + return + } + +} + +func removeWorkspaceDir(c *gin.Context) { + ret := gulu.Ret.NewResult() + defer c.JSON(http.StatusOK, ret) + + arg, ok := util.JsonArg(c, ret) + if !ok { + return + } + + path := arg["path"].(string) + + var workspacePaths []string + workspaceConf := filepath.Join(util.HomeDir, ".config", "siyuan", "workspace.json") + data, err := os.ReadFile(workspaceConf) + if nil != err { + logging.LogErrorf("read workspace conf failed: %s", err) + } else { + if err = gulu.JSON.UnmarshalJSON(data, &workspacePaths); nil != err { + logging.LogErrorf("unmarshal workspace conf failed: %s", err) + } + } + + workspacePaths = gulu.Str.RemoveElem(workspacePaths, path) + if data, err = gulu.JSON.MarshalJSON(workspacePaths); nil != err { + msg := fmt.Sprintf("marshal workspace conf [%s] failed: %s", workspaceConf, err) + ret.Code = -1 + ret.Msg = msg + return + } + + if err = gulu.File.WriteFileSafer(workspaceConf, data, 0644); nil != err { + msg := fmt.Sprintf("write workspace conf [%s] failed: %s", workspaceConf, err) + ret.Code = -1 + ret.Msg = msg + return + } + + if err = os.RemoveAll(path); nil != err { + msg := fmt.Sprintf("remove workspace dir [%s] failed: %s", path, err) + ret.Code = -1 + ret.Msg = msg + return + } +} + func listWorkspaceDirs(c *gin.Context) { ret := gulu.Ret.NewResult() defer c.JSON(http.StatusOK, ret) From a4ca84376b460d109617479e15f1794a2dcd032a Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 5 Jan 2023 16:09:10 +0800 Subject: [PATCH 3/7] =?UTF-8?q?:art:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=20https://github.com/siyuan-note/siyuan/issues/4642?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/appearance/langs/en_US.json | 2 +- app/appearance/langs/es_ES.json | 2 +- app/appearance/langs/fr_FR.json | 2 +- app/appearance/langs/zh_CHT.json | 2 +- app/appearance/langs/zh_CN.json | 2 +- kernel/api/workspace.go | 7 ++++++- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 9caecda82..17b071b02 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -746,7 +746,7 @@ "about5": "Access Authorization Code", "about6": "After configuration, it will be used as the access authentication password, leave it blank to close the authentication", "about7": "Workspace dir", - "about8": "After the workspace is switched, the data in the current workspace will not be copied to the target workspace
The application will be closed automatically after modification, please restart manually", + "about8": "After the workspace is switched, the data in the current workspace will not be copied to the target workspace", "about9": "Automatically upload error messages and diagnostic data", "about10": "After enabling, it will automatically upload error information and diagnostic data through the Sentry SDK, which does not involve personal privacy data so that developers can fix bugs. The application will be closed automatically after modification, please restart manually", "about11": "Network serving", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 5ab34fe0c..d3790aaa8 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -746,7 +746,7 @@ "about5": "Código de autorización de acceso", "about6": "Después de la configuración, se utilizará como contraseña de autenticación de acceso, déjelo en blanco para cerrar la autenticación", "about7": "Directorio del espacio de trabajo", - "about8": "Después de cambiar el espacio de trabajo, los datos del espacio de trabajo actual no se copiarán en el espacio de trabajo de destino
La aplicación se cerrará automáticamente después de la modificación, por favor reinicie manualmente", + "about8": "Después de cambiar el espacio de trabajo, los datos del espacio de trabajo actual no se copiarán en el espacio de trabajo de destino", "about9": "Carga automática de mensajes de error y datos de diagnóstico", "about10": "Después de habilitarlo, cargará automáticamente información de error y datos de diagnóstico a través del Sentry SDK, que no involucra datos de privacidad personal para que los desarrolladores puede corregir errores. La aplicación se cerrará automáticamente después de la modificación, por favor, reinicie manualmente", "about11": "Red de servicio", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index ba80a6bc5..3686aa078 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -746,7 +746,7 @@ "about5": "Accès Code d'autorisation", "about6": "Configuré comme mot de passe d'authentification d'accès, laisser vide pour désactiver l'authentification.", "about7": "Répertoire de l'espace de travail", - "about8": "Une fois l'espace de travail basculé, les données de l'espace de travail actuel ne seront pas copiées dans l'espace de travail cible
L'application se fermera automatiquement après modification, merci de redémarrer manuellement", + "about8": "Une fois l'espace de travail basculé, les données de l'espace de travail actuel ne seront pas copiées dans l'espace de travail cible", "about9": "Télécharger automatiquement les messages d'erreur et les données de diagnostic", "about10": "Après l'activation, il télécharge automatiquement les informations d'erreur et les données de diagnostic via le SDK Sentry, qui n'implique pas de données de confidentialité personnelles afin que les développeurs peut corriger des bogues. L'application sera fermée automatiquement après modification, veuillez la redémarrer manuellement.", "about11": "Service de réseau", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 659416283..cd1dfbcf6 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -746,7 +746,7 @@ "about5": "存取授權碼", "about6": "配置後作為存取鑒權密碼,留空則關閉鑒權", "about7": "工作空間目錄", - "about8": "切換工作空間後不會將當前工作空間的數據複製到目標工作空間中
修改後會自動關閉應用,請手動重啟", + "about8": "切換工作空間後不會將當前工作空間的數據複製到目標工作空間中", "about9": "自動上傳報錯信息和診斷數據", "about10": "啟用後會通過 Sentry SDK 自動上傳報錯信息和診斷數據等不涉及個人隱私的數據,以便開發者修復缺陷。修改後會自動關閉應用,請手動重啟", "about11": "網路伺服", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 5cad64e79..6484e8e12 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -746,7 +746,7 @@ "about5": "访问授权码", "about6": "配置后作为访问鉴权密码,留空则关闭鉴权", "about7": "工作空间目录", - "about8": "切换工作空间后不会将当前工作空间的数据复制到目标工作空间中
修改后会自动关闭应用,请手动重启", + "about8": "切换工作空间后不会将当前工作空间的数据复制到目标工作空间中", "about9": "自动上传报错信息和诊断数据", "about10": "启用后会通过 Sentry SDK 自动上传报错信息和诊断数据等不涉及个人隐私的数据,以便开发者修复缺陷。修改后会自动关闭应用,请手动重启", "about11": "网络伺服", diff --git a/kernel/api/workspace.go b/kernel/api/workspace.go index 8def3b3ce..d6c5273b0 100644 --- a/kernel/api/workspace.go +++ b/kernel/api/workspace.go @@ -22,6 +22,7 @@ import ( "os" "path/filepath" "strings" + "time" "github.com/88250/gulu" "github.com/gin-gonic/gin" @@ -176,5 +177,9 @@ func setWorkspaceDir(c *gin.Context) { } } - util.PushMsg(model.Conf.Language(42), 1000*15) + if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container { + util.PushMsg(model.Conf.Language(42), 1000*15) + time.Sleep(time.Second * 2) + model.Close(false, 1) + } } From cded651904afbe74ddf5a6c448d6604d3ec87275 Mon Sep 17 00:00:00 2001 From: fsy0718 Date: Thu, 5 Jan 2023 16:11:44 +0800 Subject: [PATCH 4/7] feat(mermaid): sequenceDiagram show sequenceNumber (#6992) --- app/src/protyle/markdown/mermaidRender.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/markdown/mermaidRender.ts b/app/src/protyle/markdown/mermaidRender.ts index 074fb3905..1cfe19071 100644 --- a/app/src/protyle/markdown/mermaidRender.ts +++ b/app/src/protyle/markdown/mermaidRender.ts @@ -32,7 +32,8 @@ export const mermaidRender = (element: Element, cdn = Constants.PROTYLE_CDN) => useMaxWidth: true, diagramMarginX: 8, diagramMarginY: 8, - boxMargin: 8 + boxMargin: 8, + showSequenceNumbers: true // https://mermaid.js.org/syntax/sequenceDiagram.html#sequencenumbers }, gantt: { leftPadding: 75, From c827caba48357821c4ff0ca650307ad7b9b70cd7 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 5 Jan 2023 16:12:40 +0800 Subject: [PATCH 5/7] =?UTF-8?q?:art:=20Mermaid=20=E6=97=B6=E5=BA=8F?= =?UTF-8?q?=E5=9B=BE=E5=A2=9E=E5=8A=A0=E5=BA=8F=E5=8F=B7=20https://github.?= =?UTF-8?q?com/siyuan-note/siyuan/pull/6992?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/markdown/mermaidRender.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/protyle/markdown/mermaidRender.ts b/app/src/protyle/markdown/mermaidRender.ts index 1cfe19071..0a2d94cb6 100644 --- a/app/src/protyle/markdown/mermaidRender.ts +++ b/app/src/protyle/markdown/mermaidRender.ts @@ -33,7 +33,7 @@ export const mermaidRender = (element: Element, cdn = Constants.PROTYLE_CDN) => diagramMarginX: 8, diagramMarginY: 8, boxMargin: 8, - showSequenceNumbers: true // https://mermaid.js.org/syntax/sequenceDiagram.html#sequencenumbers + showSequenceNumbers: true // Mermaid 时序图增加序号 https://github.com/siyuan-note/siyuan/pull/6992 https://mermaid.js.org/syntax/sequenceDiagram.html#sequencenumbers }, gantt: { leftPadding: 75, From 735c104af488e8e48cdcc429b9c28e39149f9576 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 5 Jan 2023 16:28:52 +0800 Subject: [PATCH 6/7] =?UTF-8?q?:art:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=20https://github.com/siyuan-note/siyuan/issues/4642?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/workspace.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/api/workspace.go b/kernel/api/workspace.go index d6c5273b0..b1b5970fb 100644 --- a/kernel/api/workspace.go +++ b/kernel/api/workspace.go @@ -98,6 +98,10 @@ func removeWorkspaceDir(c *gin.Context) { ret.Msg = msg return } + + if util.WorkspaceDir == path { + os.Exit(util.ExitCodeOk) + } } func listWorkspaceDirs(c *gin.Context) { From 6cc2d4189ddd1bbf93914eca665ee4c8893771a2 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 5 Jan 2023 16:45:34 +0800 Subject: [PATCH 7/7] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=90=8C=E6=97=B6=E6=89=93=E5=BC=80=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4=20https://github.?= =?UTF-8?q?com/siyuan-note/siyuan/issues/4567?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/electron/main.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/electron/main.js b/app/electron/main.js index a522b8871..f18f3621a 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -56,10 +56,8 @@ try { } } catch (e) { console.error(e) - require('electron'). - dialog. - showErrorBox('创建配置目录失败 Failed to create config directory', - '思源需要在用户家目录下创建配置文件夹(~/.config/siyuan),请确保该路径具有写入权限。\n\nSiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.') + require('electron').dialog.showErrorBox('创建配置目录失败 Failed to create config directory', + '思源需要在用户家目录下创建配置文件夹(~/.config/siyuan),请确保该路径具有写入权限。\n\nSiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.') app.exit() } @@ -439,7 +437,7 @@ const initKernel = (workspace, lang) => { }, ) kernelProcessPid = kernelProcess.pid - writeLog('booted kernel process [pid=' + kernelProcessPid + ']') + writeLog('booted kernel process [pid=' + kernelProcessPid + ', port=' + kernelPort + ']') kernelProcess.on('close', (code) => { writeLog(