Rev 969 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 969 | Rev 976 | ||
|---|---|---|---|
| Line 54... | Line 54... | ||
| 54 | 54 | ||
| 55 | void SyslogStream::add(string str) |
55 | void SyslogStream::add(string str) |
| 56 | { |
56 | { |
| 57 | syslog(LOG_ODELAY, str.c_str()); |
57 | syslog(LOG_ODELAY, str.c_str()); |
| 58 | 58 | ||
| - | 59 | if (str == "\n") |
|
| - | 60 | { |
|
| 59 | cout << str; |
61 | cout << str; |
| - | 62 | } |
|
| - | 63 | else |
|
| - | 64 | { |
|
| - | 65 | struct tm tmStruct; |
|
| - | 66 | time_t t = time(NULL); |
|
| - | 67 | gmtime_r(&t, &tmStruct); |
|
| - | 68 | ||
| - | 69 | cout << "[" |
|
| - | 70 | << lpad(itos(tmStruct.tm_hour), 2, '0') |
|
| - | 71 | << ":" |
|
| - | 72 | << lpad(itos(tmStruct.tm_min), 2, '0') |
|
| - | 73 | << ":" |
|
| - | 74 | << lpad(itos(tmStruct.tm_sec), 2, '0') |
|
| - | 75 | << "] " |
|
| - | 76 | << str; |
|
| - | 77 | } |
|
| 60 | } |
78 | } |
| 61 | 79 | ||
| 62 | SyslogStream& SyslogStream::operator <<(const string& str) |
80 | SyslogStream& SyslogStream::operator <<(const string& str) |
| 63 | { |
81 | { |
| 64 | add(str); |
82 | add(str); |