vscode 运行Rust cargo test时显示log输出

使用以下tasks.json

对于log库的输出(info,debug,warn...) 需要 在test方法上一行加 #[test_log::test] (来自 test-log https://crates.io/crates/test-log)


{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "problemMatcher": [
                "$rustc"
            ],
            "command": "cargo",
            "args": [
                "test",
                "'--'",
                "--nocapture",
            ],
            "group": "test",
            "label": "rust: cargo test nocapture"
        }
    ],
    "options": {
        "env": {
            "RUST_LOG": "DEBUG"
        }
    }
}
posted @   jing砸鸭  阅读(231)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示