Explorar el Código

hotfix: 允许定制日志路径,以区分使用同一个 ID 登录多个站点的情景

dzp hace 2 años
padre
commit
8282ca3761
Se han modificado 4 ficheros con 13 adiciones y 2 borrados
  1. 7 2
      framework/main.tin
  2. 4 0
      ids/DEFAULT
  3. 1 0
      ids/EXAMPLE
  4. 1 0
      ids/EXAMPLE-xyj

+ 7 - 2
framework/main.tin

@@ -20,8 +20,13 @@ PaoTin++ © 2020~2022 的所有版权均由担子炮(dzp <danzipao@gmail.com>) 
         #return;
     };
 
-    #if { "@InitLog{$user[id]}" != "true" } {
-        #echo {<110>创建日志目录 $gLog[PATH]/$user[id] 时遇到错误。<070>};
+    #local path {$user[id]};
+    #if { "$session[log_path]" != "" } {
+        #local path {$session[log_path]};
+    };
+
+    #if { "@InitLog{$path}" != "true" } {
+        #echo {<110>创建日志目录 $gLog[PATH]/$path 时遇到错误。<070>};
         #echo {<130>请检查你的安装环境,或者参考使用手册重新安装本软件。<070>};
         #return;
     };

+ 4 - 0
ids/DEFAULT

@@ -30,6 +30,10 @@ mudlib.Set {pkuxkx};
 #var session[reconnect_slow]    600;    #nop 维护模式下的间隔;
 #var session[remote_maint]      false;  #nop 维护模式开关;
 
+#nop 日志相对路径,留空则使用 user[id] 的值;
+#nop 如果有同一个 ID 连接不同站点的需求,就应当在 ID 配置文件里定制它;
+#var session[log_path]          {};
+
 #nop 可以通过触发来开启维护模式;
 #action {^%*(%*)告诉你:开启远程维护$} {#var session[remote_maint] {true}};
 

+ 1 - 0
ids/EXAMPLE

@@ -24,6 +24,7 @@ PaoTin++ © 2020~2022 的所有版权均由担子炮(dzp <danzipao@gmail.com>) 
 #var user[passwd]   bar;
 
 #nop XXX: 所有 ids/DEFAULT 里的内容都可以在这里定制;
+#nop 这里为了简单起见没有全部列出,如有更多需求请参考 ids/DEFAULT 定制;
 
 #nop 用户上线之后想要自动执行的代码写这里;
 #alias {user-online} {

+ 1 - 0
ids/EXAMPLE-xyj

@@ -29,6 +29,7 @@ mudlib.Set thuxyj;
 #var user[passwd]   bar;
 
 #nop XXX: 所有 ids/DEFAULT 里的内容都可以在这里定制;
+#nop 这里为了简单起见没有全部列出,如有更多需求请参考 ids/DEFAULT 定制;
 
 #nop 用户上线之后想要自动执行的代码写这里;
 #alias {user-online} {