tabby-logging
v0.1.13
Published
Tabby SSH session log recorder: a Logging button next to Reconnect, timestamps every line into clean text files, customizable filename and directory
Maintainers
Readme
tabby-logging
Tabby SSH 会话日志插件:在 SSH 会话工具栏的 Reconnect(重新连接) 按钮旁边加一个 Logging 按钮,点击后将终端会话的每一行输出带时间戳记成文件,方便事后回看和审计。
功能
- Logging 按钮:显示在 SSH 会话工具栏 Reconnect 按钮旁边。点 Save 开始记录;点 Cancel 不记录,下次点击还会再问。
- 文件名可改:弹窗预填默认文件名(如
myserver-20260820-143000),可改成任意名字。 - 每一行带时间戳:
[2026-08-20 14:30:00] root@myserver:~# [2026-08-20 14:30:03] ls -la [2026-08-20 14:30:03] total 12 - 只记干净文本:自动剥除终端颜色码、控制字符等乱码,用记事本/VSCode 直接打开即可读。
- 保存位置、格式全可配:在 Tabby 设置 → Logging 里配置保存目录、文件名模板、时间戳模板、按钮显示范围(仅 SSH / 所有会话),并支持一键开关按钮。
- 会话结束自动保存:断开连接或关闭标签页时,日志自动写完并保存。
- 同名不覆盖:文件名冲突自动加
-1、-2后缀。
安装
Tabby 通过 %APPDATA%\tabby\plugins(Windows)下的 package.json 管理插件。把本插件加入依赖即可:
{
"dependencies": {
"tabby-logging": "^0.1.7"
}
}然后在插件目录执行 npm install --legacy-peer-deps,重启 Tabby。
本地开发时也可以直接用打包产物安装:
{
"dependencies": {
"tabby-logging": "file:/path/to/tabby-logging-0.1.7.tgz"
}
}开发 / 构建
npm install --legacy-peer-deps # Angular 15 + TS5 的 peer 依赖冲突,需 legacy 模式
npm run build # 输出 dist/index.js
npm run watch # 开发模式,监听改动
npm pack # 打包成 tgz 供安装使用
- 打开 SSH 会话,把鼠标移到终端顶部工具栏,点击 Logging 按钮。
- 弹窗里确认保存目录和文件名(可直接编辑),点 Save。
- 开始记录后按钮变为 Recording…,再点一次会弹出确认框,确认后停止并保存(防止误触);断开连接或关闭标签页时也会自动保存。
设置(Tabby 设置 → Logging)
| 选项 | 说明 | 默认值 |
|------|------|--------|
| Enable Logging button | 总开关,关闭后按钮立即从所有终端消失 | 开 |
| Session types | 按钮显示范围:仅 SSH / 所有会话 | SSH only |
| Save directory | 日志保存目录(支持 ~/ 展开) | ~/Downloads/TabbyLogs |
| Filename template | 文件名模板,可用 {session} {date} {time} | {session}-{date}-{time} |
| Timestamp template | 时间戳模板,可用 {year} {month} {day} {hour} {minute} {second} | [{year}-{month}-{day} {hour}:{minute}:{second}] |
原理
- 通过 Tabby 官方
TerminalDecorator扩展点注入按钮,用fa-redo图标定位 Reconnect 按钮(语言无关)。 - 监听
session.output$,先清洗 ANSI 转义码,再按行切分,逐行加时间戳写入文件。 - 配置存于 Tabby 配置的
logging命名空间,持久化到config.yaml。
免责声明 / Disclaimer
中文
- 本插件会把 SSH 会话内容(包括你输入的命令和输出)以纯文本写入本地日志文件。日志中可能包含敏感信息(口令、密钥、个人数据等),请妥善保管日志文件,避免泄露。
- 日志仅保存在你配置的本地目录,插件本身不会上传任何数据。
- 本插件按「现状」提供,不附带任何明示或默示的担保;因使用本插件产生的任何损失,作者不承担责任。
English
- This plugin writes SSH session content (including commands you type and their output) as plain text into local log files. Logs may contain sensitive information (passwords, keys, personal data, etc.). Please keep the log files secure and avoid leaking them.
- Logs are stored only in the local directory you configure; the plugin does not upload any data.
- This plugin is provided "as is", without warranty of any kind, express or implied. The author is not liable for any damages arising from its use.
关于 AI 编程 / About AI
中文:本插件的代码由 AI 编程助手 辅助实现,并经过人工实际运行验证。请在使用前自行审查代码。
English: This plugin's code was developed with the assistance of AI coding assistant, and has been manually verified in real usage. Please review the code yourself before using it.
License
MIT
