Changeset 42
Author: tyr377
(2011/08/19 04:48) 9 months ago
logging functionality for raw data implemented (printing a hex dump)
Author: tyr377
(2011/08/19 04:48) 9 months ago
logging functionality for raw data implemented (printing a hex dump)
static FILE* getStream(LogLevel level) {static std::string getTimestamp() {struct _timeb timebuffer;_ftime_s( &timebuffer );struct tm* time = gmtime(&(timebuffer.time));const char* timeformat = "%Y-%m-%dT%H:%M:%S"; // TODO: output with milliseconds would be nicechar t[20];_locale_t t;strftime(t,20,timeformat,time); // TODO: time is UTC based, time zone based would be nicef << t << " " << LogLevelToString(level) << " (" << file << ":" << line << ") : ";f << getTimestamp() << " " << LogLevelToString(level) << " (" << file << ":" << line << ") : ";if (format) {char* buffer = NULL;int size = 0;if (format)vprintf(f.str().c_str(), argptr);} elsef << "\n";printf(f.str().c_str());void Log::printHexDump(const char* file, int line, unsigned char* buffer, size_t len) {msg << getTimestamp() << " " << LogLevelToString(DEBUG) << " (" << file << ":" << line << ") :\n";for (size_t n = 0; n < len; ++n) {if (n%16 == 0 ) {void Log::setLogLevel(LogLevel level) {void Log::setLogLevel(LogLevel level) {int main(int argc, char** argv) {int main(int argc, char** argv) {LOG_DEBUG("hier");