This is a low-level network debugging utility that utilizes raw packet i/o to construct and deconstruct tcp, udp, ipv4, arp, and icmp packets over ethernet.
Diff: util/log.h
- Revision:
- 4:88fc7fa58931
- Parent:
- 0:d494b853ce97
- Child:
- 6:66c4cd9073aa
--- a/util/log.h Tue Oct 12 06:14:19 2010 +0000 +++ b/util/log.h Tue Oct 12 06:21:05 2010 +0000 @@ -8,8 +8,7 @@ #define LOG_BUFSIZE 4096 - - +/// Enumeration used to enable/disable various serial lines in the logger typedef enum { LOG_USB = 0, LOG_SER_9_10, @@ -18,6 +17,7 @@ LOG_MAX } SerialLines; +/// Combination serial/file logger class Log { private: // Accomodate all 3 serial ports and USB @@ -28,6 +28,7 @@ LocalFileSystem local; public: + /// Constructor inline Log() : local("local") { // Write to file @@ -48,20 +49,20 @@ } } - // Enable logging to the given serial line + /// Enable logging to the given serial line inline void enable(SerialLines idx) { m_enable[idx] = true; } - // Disable logging to the given serial line + /// Disable logging to the given serial line inline void disable(SerialLines idx) { m_enable[idx] = false; } - // This can log messages up to 4095 characters and has printf semantics - // All log messages include an implicit \r\n at the end + /// This can log messages up to 4095 characters and has printf semantics + /// All log messages include an implicit \r\n at the end inline bool printf(char *format, ...) { static char buffer[LOG_BUFSIZE]; @@ -88,6 +89,7 @@ return true; } // printf + /// Put the given string (no implicit \r\n) on all enabled serial lines and to the logfile bool puts(const char *str) { // Write to file