commit - 91d2ac5e163752e9b29c7a8884fc8b6888f4b7b6
commit + 56b35e42d570e4505081c2f1a9f8bc94704c7045
blob - eb810194c7e45b1bd4610a9de35f1594bfd49ae9
blob + 6e07ccb5198ce78f4445f81a58349dd0f139d72e
--- log.c
+++ log.c
void
log_access(const struct client_connection *cc, const char *fmt, ...)
{
+ char tmstr[29];
struct tm tm;
time_t t;
t = time(NULL);
tm = *localtime(&t);
- user_log(0, "%s - - [%d/%d/%d:%d:%d:%d %s] %s", cc->client_addr,
- tm.tm_mday, tm.tm_mon, tm.tm_year+1900,
- tm.tm_hour, tm.tm_min, tm.tm_sec,
- tm.tm_zone, fmt);
+ strftime(tmstr, sizeof(tmstr), "%d/%b/%Y:%H:%M:%S %Z", &tm);
+
+ user_log(0, "%s - - [%s] %s", cc->client_addr, tmstr, fmt);
}
void
log_error(const struct client_connection *cc, const char *fmt, ...)
{
+ char tmstr[29];
struct tm tm;
time_t t;
t = time(NULL);
tm = *localtime(&t);
+ strftime(tmstr, sizeof(tmstr), "%d/%b/%Y:%H:%M:%S %Z", &tm);
- 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);
+ user_log(1, "[%s] [error] [client %s] %s", tmstr,
+ cc->client_addr, fmt);
}
void