Skip to content

Banner 与启动流程 ​

🎨 r0capture 启动时打印的彩色 ASCII banner 及启动顺序。

启动时调用 show_banner() 打印:

           .oooo.
          d8P'`Y8b
oooo d8b 888    888  .ooooo.   .oooo.   oo.ooooo.  ...
`888""8P 888    888 d88' `"Y8 `P  )88b   888' `88b  ...
 ...
                    https://github.com/r0ysue/r0capture

每行随机选一种颜色(bright_red/bright_green/bright_blue/cyan/magenta),若终端不支持 bright 色,退回普通色。

启动顺序 ​

文件日志 ​

python
logger.add(
    f"{parsed.process.replace('.','_')}-{int(time.time())}.log",
    rotation="500MB",
    encoding="utf-8",
    enqueue=True,
    retention="10 days"
)
  • 文件名:<进程名_下划线>-<时间戳>.log
  • 单文件超 500MB 自动轮转
  • enqueue=True:多线程安全写入
  • retention="10 days":10 天后自动清理

ArgParser 的友好错误 ​

自定义 ArgParser 重写 error(),出错时不抛栈,而是打印版本信息和帮助后 exit(0):

python
def error(self, message):
    print("ssl_logger v" + __version__)
    print("by " + __author__)
    print("Modified by BigfaceCat")
    print("Error: " + message)
    print(self.format_help().replace("usage:", "Usage:"))
    self.exit(0)

相关文档 ​

基于 VitePress 构建 · 教学用途