35 |
|
#endif |
36 |
|
|
37 |
|
#include "client.h" /* Needed for struct Client */ |
38 |
– |
#include "common.h" |
38 |
|
#include "s_log.h" |
39 |
|
#include "fileio.h" |
40 |
|
#include "irc_string.h" |
111 |
|
if (logFile == NULL) |
112 |
|
return; |
113 |
|
|
115 |
– |
#ifdef _WIN32 |
116 |
– |
nbytes = snprintf(buf, sizeof(buf), "[%s] %s\r\n", |
117 |
– |
#else |
114 |
|
nbytes = snprintf(buf, sizeof(buf), "[%s] %s\n", |
119 |
– |
#endif |
115 |
|
smalldate(CurrentTime), message); |
116 |
+ |
|
117 |
|
fbputs(buf, logFile, nbytes); |
118 |
|
} |
119 |
|
|
132 |
|
return; |
133 |
|
|
134 |
|
va_start(args, fmt); |
135 |
< |
vsprintf(buf, fmt, args); |
135 |
> |
vsnprintf(buf, sizeof(buf), fmt, args); |
136 |
|
va_end(args); |
137 |
|
|
138 |
|
#ifdef USE_SYSLOG |
197 |
|
void |
198 |
|
log_user_exit(struct Client *source_p) |
199 |
|
{ |
200 |
< |
time_t on_for = CurrentTime - source_p->firsttime; |
200 |
> |
time_t on_for = CurrentTime - source_p->localClient->firsttime; |
201 |
|
#ifdef SYSLOG_USERS |
202 |
|
if (IsClient(source_p)) |
203 |
|
{ |
204 |
< |
ilog(L_INFO, "%s (%3ld:%02ld:%02ld): %s!%s@%s %llu/%llu\n", |
205 |
< |
myctime(source_p->firsttime), |
206 |
< |
(signed long) on_for / 3600, |
207 |
< |
(signed long) (on_for % 3600)/60, |
208 |
< |
(signed long) on_for % 60, |
209 |
< |
source_p->name, source_p->username, source_p->host, |
214 |
< |
source_p->localClient->send.bytes>>10, |
215 |
< |
source_p->localClient->recv.bytes>>10); |
204 |
> |
ilog(L_INFO, "%s (%3u:%02u:%02u): %s!%s@%s %llu/%llu", |
205 |
> |
myctime(source_p->localClient->firsttime), (unsigned int)(on_for / 3600), |
206 |
> |
(unsigned int)((on_for % 3600)/60), (unsigned int)(on_for % 60), |
207 |
> |
source_p->name, source_p->username, source_p->host, |
208 |
> |
source_p->localClient->send.bytes>>10, |
209 |
> |
source_p->localClient->recv.bytes>>10); |
210 |
|
} |
211 |
|
#else |
212 |
|
{ |
233 |
|
if (user_log_fb != NULL) |
234 |
|
{ |
235 |
|
size_t nbytes = ircsprintf(linebuf, |
236 |
< |
"%s (%3ld:%02ld:%02ld): %s!%s@%s %llu/%llu\n", |
237 |
< |
myctime(source_p->firsttime), |
238 |
< |
(signed long) on_for / 3600, |
239 |
< |
(signed long) (on_for % 3600)/60, |
240 |
< |
(signed long) on_for % 60, |
236 |
> |
"%s (%3u:%02u:%02u): %s!%s@%s %llu/%llu\n", |
237 |
> |
myctime(source_p->localClient->firsttime), |
238 |
> |
(unsigned int)(on_for / 3600), |
239 |
> |
(unsigned int)((on_for % 3600)/60), |
240 |
> |
(unsigned int)(on_for % 60), |
241 |
|
source_p->name, source_p->username, source_p->host, |
242 |
|
source_p->localClient->send.bytes>>10, |
243 |
|
source_p->localClient->recv.bytes>>10); |