This Project Has Not Released Any Files
log4cpp::NDCを使ったサンプルで、NDC(ネスト化診断コンテキスト)が、どのようなものなのかを示すものとなっています。
testNDC.cpp
- #include <iostream>
- #include "log4cpp/NDC.hh"
- using namespace log4cpp;
- int main(int argc, char** argv) {
- std::cout << "1. empty NDC: " << NDC::get() << std::endl;
- NDC::push("context1");
- std::cout << "2. push context1: " << NDC::get() << std::endl;
- NDC::push("context2");
- std::cout << "3. push context2: " << NDC::get() << std::endl;
- NDC::push("context3");
- std::cout << "4. push context3: " << NDC::get() << std::endl;
- std::cout << "5. get depth: " << NDC::getDepth() << std::endl;
- std::cout << "6. pop: " << NDC::pop() << std::endl;
- NDC::clear();
- std::cout << "7. clear: " << NDC::get() << std::endl;
- return 0;
- }
testNDC.cppをビルドし、実行した結果です。実行環境はLinux(Ubuntu 11.0)です。
stdout(標準出力):
1. empty NDC: 2. push context1: context1 3. push context2: context1 context2 4. push context3: context1 context2 context3 5. get depth: 3 6. pop: context3 7. clear:
[PageInfo]
LastUpdate: 2012-05-13 09:11:53, ModifiedBy: daruma_kyo
[License]
GNU Free Documentation License
[Permissions]
view:all, edit:login users, delete/config:members