|
@@ -113,7 +113,7 @@ const char* ttail_logline_subst(ttail_t* t, const char* logline)
|
113
|
113
|
}
|
114
|
114
|
/* regex subst */
|
115
|
115
|
nmatch=1;
|
116
|
|
- ret = regexec(&(t->date_prefix), logline, nmatch, pmatch, 0);\
|
|
116
|
+ ret = regexec(&(t->date_prefix), logline, nmatch, pmatch, 0);
|
117
|
117
|
if(ret)
|
118
|
118
|
{
|
119
|
119
|
regerror(ret, &(t->date_prefix), err,1024);
|
|
@@ -178,3 +178,31 @@ void ttail_tm_print(const struct tm* tm)
|
178
|
178
|
tm->tm_sec);
|
179
|
179
|
}
|
180
|
180
|
|
|
181
|
+void ttail_tm_fprint(FILE *stream, const struct tm* tm)
|
|
182
|
+{
|
|
183
|
+ if(tm->tm_year >= 0)
|
|
184
|
+ {
|
|
185
|
+ fprintf(stream, "year : %d ", tm->tm_year + 1900);
|
|
186
|
+ }
|
|
187
|
+ if(tm->tm_mon >= 0)
|
|
188
|
+ {
|
|
189
|
+ fprintf(stream, "month : %d ", tm->tm_mon);
|
|
190
|
+ }
|
|
191
|
+ if(tm->tm_mday >= 0)
|
|
192
|
+ {
|
|
193
|
+ fprintf(stream, "day : %d ", tm->tm_mday);
|
|
194
|
+ }
|
|
195
|
+ if(tm->tm_hour >= 0)
|
|
196
|
+ {
|
|
197
|
+ fprintf(stream, "hour : %d ", tm->tm_hour);
|
|
198
|
+ }
|
|
199
|
+ if(tm->tm_min >= 0)
|
|
200
|
+ {
|
|
201
|
+ fprintf(stream, "minute : %d ", tm->tm_min);
|
|
202
|
+ }
|
|
203
|
+ if(tm->tm_sec >= 0)
|
|
204
|
+ {
|
|
205
|
+ fprintf(stream, "secs : %d ", tm->tm_sec);
|
|
206
|
+ }
|
|
207
|
+}
|
|
208
|
+
|