【发布时间】:2009-09-18 03:18:08
【问题描述】:
我继承了一个相当大的代码库,90% 是 C++,我需要快速上手。宽目录树结构中有数百个 .cc 文件。
它相当复杂,并且没有日志记录。为了弄清楚一些主要子系统是如何工作的,我想在每个函数中插入一个函数调用。
例如,给定一个 .cc 文件,其中包含以下内容:
void A::foo(int a, int b) {
// ...
}
void A::bar() {
// ...
}
void B::bleh(const string& in) {
// ...
}
我想要这个:
void A::foo(int a, int b) {
LOG(debug) << "A::foo() called.";
// ...
}
void A::bar() {
LOG(debug) << "A::bar() called.";
// ...
}
void B::bleh(const string& in) {
LOG(debug) << "B::bleh() called.";
// ...
}
这可以通过 python 脚本、CMD 脚本、power shell 脚本等来完成。如果有办法让 VS 做到这一点,那就太好了。什么都行。不一定要漂亮,我不会检查这些。
此外,它不一定需要获取所有内容。例如。嵌套类、头文件中的实现等
【问题讨论】:
-
你是怎么做到的?
标签: c++ windows logging scripting