← 返回
数据分析 中文

Pywayne Bin Cmdlogger

Execute commands with real-time console output while logging all stdin, stdout, and stderr to a customizable log file for monitoring and debugging.
实时显示控制台输出,同时将所有标准输入、标准输出和标准错误记录到可自定义的日志文件,用于监控和调试。
wangyendt
数据分析 clawhub v0.1.0 1 版本 99904.7 Key: 无需
★ 0
Stars
📥 1,048
下载
💾 18
安装
1
版本
#latest

概述

Pywayne Bin Cmdlogger

Execute a command and log all stdin, stdout, stderr to a file while forwarding I/O to console in real-time.

Quick Start

# Log command execution to default file (io_log.log in script directory)
cmdlogger <command> [args...]

# Specify custom log file path
cmdlogger --log-path <log_path> <command> [args...]

Usage Examples

Build Process Recording

# Log CMake configuration
cmdlogger --log-path cmake_config.log cmake ..

# Log build process
cmdlogger --log-path build.log make -j$(nproc)

Script Execution Monitoring

# Log Python script execution
cmdlogger --log-path script_run.log python3 my_script.py --arg1 value1

# Log shell script execution
cmdlogger --log-path deploy.log ./deploy.sh production

Debugging Sessions

# Log GDB debug session
cmdlogger --log-path debug_session.log gdb ./my_program

# Log Python interactive session
cmdlogger --log-path python_debug.log python3 -i my_module.py

Network Operations

# Log curl request with verbose output
cmdlogger --log-path api_test.log curl -v https://api.example.com/data

# Log SSH connection process
cmdlogger --log-path ssh_session.log ssh user@remote-host

Simple Command Logging

# Log git status
cmdlogger git status

# Log echo command
cmdlogger echo "Hello World"

Command Reference

ArgumentDescription
-----------------------
commandThe command to execute
[args...]Command arguments
--log-path Optional log file path. Default: io_log.log in script directory

Log Format

Each line in the log file is prefixed with stream type:

  • 输入: - Standard input
  • 输出: - Standard output
  • 错误: - Standard error

Example Log Output

Running cmdlogger echo "Hello World" produces:

输出: Hello World

Running cmdlogger python3 -c "import sys; print('stdout'); print('stderr', file=sys.stderr)" produces:

输出: stdout
错误: stderr

Features

  • Full I/O Recording: Captures all stdin, stdout, stderr
  • Real-time Forwarding: Forwards I/O to console while logging
  • Multi-threaded: Uses separate threads for stdin, stdout, stderr
  • Encoding Handling: Gracefully handles non-UTF-8 data
  • Resource Cleanup: Automatically cleans up processes and files

Use Cases

  • Recording complex build processes for later analysis
  • Monitoring long-running scripts with full logging
  • Debugging with complete input/output history
  • CI/CD pipeline execution logging
  • Performance analysis with execution traces

Important Notes

  • Interactive Commands: User input (including passwords) is logged. Be careful with sensitive information.
  • Large Output: Log files can become large for commands with heavy output. Ensure sufficient disk space.
  • Default Log Location: If --log-path is not specified, log file is created in the script directory as io_log.log.
  • Exit Codes: Returns the exit code of the executed command (127 if command not found).

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-29 06:30 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 199 📥 65,290
data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,931
productivity

Pywayne Statistics

wangyendt
综合性统计检验库,包含37种以上方法,涵盖正态性检验、位置检验、相关性检验、时间序列检验和模型诊断。
★ 0 📥 1,875