diff options
| author | ruki <[email protected]> | 2022-04-05 23:55:03 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-05 23:55:03 +0800 |
| commit | 27f4fa5d40abbc7d6e2177531f6c7b6fad91e16c (patch) | |
| tree | e8a0711a4c71c509a4aad87fd0094e8afce3f5fd | |
| parent | 43431946fbd66c1ff6c9726e93527efa7cf7dc98 (diff) | |
impl show logs for service
| -rw-r--r-- | xmake/modules/private/service/show_logs.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/xmake/modules/private/service/show_logs.lua b/xmake/modules/private/service/show_logs.lua index a0d3b7683..0875b1515 100644 --- a/xmake/modules/private/service/show_logs.lua +++ b/xmake/modules/private/service/show_logs.lua @@ -20,8 +20,25 @@ -- imports import("core.base.option") -import("private.service.service") +import("private.service.config") function main() + local log + local logfile = config.get("logfile") + while not log do + if os.isfile(logfile) then + log = io.open(logfile, "r") + break + end + os.sleep(1000) + end + while true do + local line = log:read("l") + if line and #line > 0 then + print(line) + else + os.sleep(500) + end + end end |
