commit 6f690542b3c62116a0d6a6e2788721d6e55d87b1 from: the xhr date: Thu Aug 19 15:08:18 2021 UTC Implement error logging commit - 9094a4c77211b5f6b7039468515a075054a55720 commit + 6f690542b3c62116a0d6a6e2788721d6e55d87b1 blob - 11c17f35315108a4c914693933cfc8807a451264 blob + 2bb41335492b33d1bd58f9bac45d99679d210051 --- log.c +++ log.c @@ -237,6 +237,23 @@ log_access(const struct client_connection *cc, const c } void +log_error(const struct client_connection *cc, const char *fmt, ...) +{ + struct tm tm; + time_t t; + + t = time(NULL); + tm = *localtime(&t); + + user_log(1, "[%d/%d/%d:%d:%d:%d %s] [error] [client %s] %s", + tm.tm_mday, tm.tm_mon, tm.tm_year+1900, + tm.tm_hour, tm.tm_min, tm.tm_sec, + tm.tm_zone, + cc->client_addr, + fmt); +} + +void user_log(int target, const char *fmt, ...) { va_list ap;