00001
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <time.h>
00015
00016 #include "CTB.hxx"
00017 #include "CTBprintf.hxx"
00018 #include "CTBlog.hxx"
00019
00025
00027
00028 void CTBlogHead::ToStream(ostream& os) const
00029 {
00030 time_t i_time = time(0);
00031 struct tm* ps_time = localtime(&i_time);
00032 char * c_mtable[12] = {"Jan","Feb","Mar","Apr","May","Jun",
00033 "Jul","Aug","Sep","Oct","Nov","Dec"};
00034
00035
00036 if (ps_time->tm_year != mi_lastyear ||
00037 ps_time->tm_mon != mi_lastmon ||
00038 ps_time->tm_mday != mi_lastmday) {
00039 mi_lastyear = ps_time->tm_year;
00040 mi_lastmon = ps_time->tm_mon;
00041 mi_lastmday = ps_time->tm_mday;
00042 os << " -+- " << CTBprintf(ps_time->tm_mday,"d0",2) << "-"
00043 << c_mtable[ps_time->tm_mon] << "-"
00044 << CTBprintf(ps_time->tm_year+1900,"d",4) << " -+- \n";
00045 }
00046
00047 os << " --- " << CTBprintf(ps_time->tm_hour,"d0",2) << ":"
00048 << CTBprintf(ps_time->tm_min,"d0",2) << ":"
00049 << CTBprintf(ps_time->tm_sec,"d0",2) << " --- ";
00050
00051 return;
00052 }
00053
00054
00055 CTBint32 CTBlogHead::mi_lastyear = 0;
00056 CTBint32 CTBlogHead::mi_lastmon = 0;
00057 CTBint32 CTBlogHead::mi_lastmday = 0;
00058
00059
00065
00067
00068 void CTBlogTail::ToStream(ostream& os) const
00069 {
00070 os << endl;
00071 return;
00072 }
00073
00074
00080
00082
00083 void CTBlogLine::ToStream(ostream& os) const
00084 {
00085 os << CTBlogHead();
00086 if (mc_message) os << mc_message;
00087 os<< CTBlogTail();
00088 return;
00089 }
00090
00091
00092 #if (defined(CTB__OutLine) || defined(CTBlog__OutLine))
00093 #define inline
00094 #include "CTBlog.icc"
00095 #undef inline
00096 #endif