Bỏ qua, đến nội dung

@digiforce-nc/plugin-logger

Plugin nhật ký hệ thống — cho phép admin xem, tìm kiếm, và tải về file log từ server qua giao diện web.

Plugin này làm gì?

Khi cần debug hay audit, admin cần truy cập log files trên server. plugin-logger cung cấp giao diện UI để duyệt danh sách file log, chọn file cần thiết, và download dưới dạng logs.tar.gz — không cần SSH vào server.

Ba nhiệm vụ chính

#Nhiệm vụChi tiết
1Liệt kêDuyệt file .log trên server theo tree structure
2DownloadChọn file → tải về logs.tar.gz (đóng gói bằng tar-fs)
3CollectFrontend gửi diagnostic data → server ghi log + trả tarball gộp

Kiến trúc

Luồng download

API endpoints

EndpointMethodMô tả
logger:listGETDanh sách file log (tree structure)
logger:downloadPOSTDownload file đã chọn → tar.gz. Body: { files: ["app.log", "sql.log"] }
logger:collectPOSTGhi diagnostic log từ frontend + trả tarball log gần nhất

Bảo mật

  • API kiểm tra path traversal — không cho phép truy cập file ngoài thư mục log
  • Chỉ cho phép đọc file có extension .log
  • ACL snippet: pm.logger — chỉ admin được truy cập

Không có database

Plugin đọc trực tiếp từ filesystem — không tạo bảng nào. Thư mục log được xác định từ @digiforce-nc/logger config.

Thành phần client

Thành phầnMô tả
LogsDownloaderTrang chính (Settings → Logger): Ant Design Tree hiển thị file log
FileTreeComponent tree view với checkbox chọn file
DownloadButtonNút download file đã chọn thành tar.gz
DiagnosticCollectorThu thập và gửi log diagnostic từ frontend

Dependencies

PackageVai trò
@digiforce-nc/serverServer framework
@digiforce-nc/clientClient framework
@digiforce-nc/loggerLogger path utilities, log directory config
tar-fsĐóng gói file log thành tar archive

Mục lục chi tiết