|
Bugzilla – Full Text Bug Listing |
| Summary: | Option to print log level in NS_LOG messages | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Peter Barnes <pdbarnes> |
| Component: | documentation | Assignee: | Tom Henderson <tomh> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | ns-bugs, tomh |
| Priority: | P5 | ||
| Version: | ns-3-dev | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://www.nsnam.org/bugzilla/show_bug.cgi?id=1531 | ||
| Attachments: | diff of src/core/model/log.{h,cc} | ||
Also added "prefix_all", as you'll see in the diff. Relabel to core component. ok for commit. Can you please update this bug report with the commit changeset once you are done ? Commit 9c0cc3997ece http://code.nsnam.org/ns-3-dev/rev/9c0cc3997ece I volunteered to write a manual chapter, but that's going to have to wait, along with some ideas for wildcards... I'm reopening this, as this doesn't seem to behave as expected as of ns-3.16: NS_LOG="*=all|prefix_all" ./waf --run first nor this: NS_LOG="*=all|prefix_all" ./waf --run scratch-simulator (prefix levels are not printed out) Also, the scratch-simulator.cc program was not patched as described in the tracker. actually, after further testing and reading the patch, it seems to be working since it is limited to these levels: + labels[LOG_ERROR] = "ERROR"; + labels[LOG_WARN] = "WARN"; + labels[LOG_DEBUG] = "DEBUG"; + labels[LOG_INFO] = "INFO"; + labels[LOG_LOGIC] = "LOGIC"; but I'll leave this open until documentation is completed. Documentation: commit f70e78d94658 |
Created attachment 1438 [details] diff of src/core/model/log.{h,cc} It'd be nice if there was an option to print the LOG_LEVEL (severity) in the message, similar to prefixing the time, node, or function. This patch enables NS_LOG="*=all|prefix_level" and prints as [ERROR] error message [WARN] warn message [DEBUG] debug message [INFO] info message [LOGIC] logic message $ NS_LOG="*=all|prefix_all" ./waf --run scratch-simulator Scratch Simulator ScratchSimulator:main(): [ERROR] error message ScratchSimulator:main(): [WARN] warn message ScratchSimulator:main(): [DEBUG] debug message ScratchSimulator:main(): [INFO] info message ScratchSimulator:main(function) ScratchSimulator:main(): [LOGIC] logic message (I added NS_LOG_ERROR ("error message"), etc to scratch-simulator.cc, for illustration.) If this patch is accepted, I volunteer to amend the tutorial.