--------------------------------------------------------------------------- {time} {ip} {host} {facility} {priority} {tag} {message}
| 230 | //--------------------------------------------------------------------------- |
| 231 | // {time} {ip} {host} {facility} {priority} {tag} {message} |
| 232 | String TSyslogMessage::Format(String fmt) |
| 233 | { |
| 234 | int i; |
| 235 | if( (i = fmt.Pos("{time}")) > 0 ) |
| 236 | { |
| 237 | fmt.Delete(i, 6); |
| 238 | fmt.Insert(DateStr, i); |
| 239 | } |
| 240 | if( (i = fmt.Pos("{ip}")) > 0 ) |
| 241 | { |
| 242 | fmt.Delete(i, 4); |
| 243 | fmt.Insert(SourceAddr, i); |
| 244 | } |
| 245 | if( (i = fmt.Pos("{host}")) > 0 ) |
| 246 | { |
| 247 | fmt.Delete(i, 6); |
| 248 | fmt.Insert(HostName, i); |
| 249 | } |
| 250 | if( (i = fmt.Pos("{facility}")) > 0 ) |
| 251 | { |
| 252 | fmt.Delete(i, 10); |
| 253 | fmt.Insert(Facility, i); |
| 254 | } |
| 255 | if( (i = fmt.Pos("{priority}")) > 0 ) |
| 256 | { |
| 257 | fmt.Delete(i, 10); |
| 258 | fmt.Insert(Priority, i); |
| 259 | } |
| 260 | if( (i = fmt.Pos("{tag}")) > 0 ) |
| 261 | { |
| 262 | fmt.Delete(i, 5); |
| 263 | fmt.Insert(Tag, i); |
| 264 | } |
| 265 | if( (i = fmt.Pos("{message}")) > 0 ) |
| 266 | { |
| 267 | fmt.Delete(i, 9); |
| 268 | fmt.Insert(Msg, i); |
| 269 | } |
| 270 | return fmt; |
| 271 | } |
| 272 | //--------------------------------------------------------------------------- |
| 273 | // sample: "Sep 2 09:46:37" |
| 274 | bool IsValidSyslogDate(const char * p) |