|
Bugzilla – Full Text Bug Listing |
| Summary: | Crazy Idea -- Default trace sink | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Craig Dowell <craigdo> |
| Component: | core | Assignee: | ns-bugs <ns-bugs> |
| Status: | NEW --- | ||
| Severity: | enhancement | ||
| Priority: | P5 | ||
| Version: | pre-release | ||
| Hardware: | All | ||
| OS: | All | ||
It occurred to me that it might be possible to specify a kind of default trace sink that appends traced text to the end of a file. If a bound callback is created that takes a file name and a format string to bind, it may be possible to construct a trace sink that just writes trace results to the specified file using the format string without actually having to code a trace sink (the actual trace sink could be made from a template in the core). As a wild guess on a possible syntax: Config::ConnectDefault<2> ("/NodeList ... CongestionWindow", "my-trace-file", "CongestionWindow changed from %d<a1> to %d<a2>") This would try to convince a default trace sink taking four arguments (two provided by the source + two bound) to take template argument a1 and sprintf it using %d, and take argument a2 and sprintf it using %d. This woud result in a string that looked like, "CongestionWindow changed from 1 to 2" which would be appended to the file "my-trace-file" Haven't worked it through, multithreading may require locks, but I wanted to write it down since it sounds like it would be incredibly convenient to lots of users.