#include <fstream.h>
#include <time.h>
#include <sys/time.h>
#include "debug.h"
#include "con/print.cpp"
Go to the source code of this file.
Functions | |
void | debug_agent (char *name, T &value, bool logfile=false) |
Variables | |
const char | dbgid [] = "\100$ Free Agent: debug.cpp, v 0.1 2002/05/29 red0x Exp $" |
Definition in file debug.cpp.
|
Debugging output (template function)
Definition at line 41 of file debug.cpp. 00042 { 00043 {assert(name != NULL);} 00044 //{assert(value != NULL);} 00045 time_t tm; 00046 char *stm; 00047 agent_newarr(&stm, 50); 00048 time(&tm); 00049 strftime(stm, 50, "%a %b %e %T %Z %Y", localtime(&tm)); 00050 if(logfile) 00051 { 00052 00053 fstream fp; 00054 fp.open(debug_agent_log_file,ios::out|ios::app); 00055 if(!fp.is_open()) 00056 return; 00057 00058 fp << "[" << stm << "] " << name << ": " << value << ";" << std::endl; 00059 fp.close(); 00060 //output name = value;\n 00061 } 00062 //what to do if we dont want to log it... 00063 //print it? 00064 agent_print("["); 00065 agent_print(stm); 00066 agent_print("] "); 00067 agent_print(name); 00068 agent_print(": "); 00069 agent_print(value); 00070 agent_println(";"); 00071 } |
|
|