diff options
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r-- | libsylph/utils.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c index 0ddae386..579edee7 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -3402,6 +3402,23 @@ void status_print(const gchar *format, ...) #define TIME_LEN 11 +void log_write(const gchar *str, const gchar *prefix) +{ + if (log_fp) { + gchar buf[TIME_LEN + 1]; + time_t t; + + time(&t); + strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t)); + + fputs(buf, log_fp); + if (prefix) + fputs(prefix, log_fp); + fputs(str, log_fp); + fflush(log_fp); + } +} + void log_print(const gchar *format, ...) { va_list args; |