3proxy/src
Vladimir Dubrovin d613750b94 Logs: a logger for each log string, shared and closed once unused
A logger (struct logger) is identified by the string log or -l gives it:
"" stdout, "/dev/null" none, "@IDENT" syslog, "&DSN" ODBC, "radius",
anything else a file. Each type (struct logtype) has init, formatting of
a connection into a buffer, writing, close, and a periodic tick for
rotation and flushing; ODBC and RADIUS register their types from 3proxy,
which alone has them. Services and configurations hold the logger they
use; the last to let go closes it, except the standard ones (none,
stdout, stderr, syslog), which are opened at startup and kept.

-l takes every log type now, and a file named by several services or by
both log and -l is opened once. rotate and archiver are bound to the
logger of the last log command when its configuration comes into force,
and every file logger is rotated by the main loop.

Errors with no connection go to a new stderr logger; after daemon, or as
a Windows service, stdout logging writes nothing and errors go to the
last log configured. A log whose writes keep failing is closed and
reopened; while it cannot be, its lines go to stderr and it is retried
every minute. ODBC's own reconnection throttle gives way to this.

Formatting (logbuf) is separate from counting traffic and clearing the
statistics, done once by logdo(), the services' log function, so a later
step can format or copy a connection's line and write it from a thread
of its own. dologname() and timechanged() move to log.c, which the
standalone services link as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 11:44:55 +03:00
..
libs fix wolfSSL, switch minimal/busybox to musl+wolfssl 2026-07-31 11:27:10 +03:00
plugins Keep the values of numbered traffic counters across reloads 2026-10-13 19:05:59 +03:00
3proxy_crypt.c wolfSSL support added 2026-07-13 20:24:51 +03:00
3proxy.c Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
3proxy.ico build rc file from res 2020-11-22 02:14:53 +03:00
3proxy.rc Copyright update 2021-07-02 11:50:33 +03:00
acl.c Make filtermaxsize, parentretries, delimchar and maxseg per service 2026-10-13 15:33:35 +03:00
auth.c Reload the configuration atomically 2026-10-14 20:15:14 +03:00
authradius.c Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
auto.c Pre-allocate client/server/tmp/etc buffers with client structure 2026-10-12 17:19:55 +03:00
base64.c Add outsize parameter to en64 2026-08-08 17:58:49 +03:00
common.c UDP loop: deadlines in a heap, on a monotonic clock 2026-10-22 23:53:06 +03:00
conf.c Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
confinit.h Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
datatypes.c Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
dnspr.c UDP loop: deadlines in a heap, on a monotonic clock 2026-10-22 23:53:06 +03:00
ftp.c Authorize FTP commands and data connections by the rules in force 2026-10-15 00:49:53 +03:00
ftppr.c Authorize FTP commands and data connections by the rules in force 2026-10-15 00:49:53 +03:00
hash.c Keep the clock, timetoexit and needreload out of conf 2026-10-13 16:05:33 +03:00
hashtables.c resolver: the system's name servers and hosts file by default 2026-10-20 18:49:21 +03:00
httpsrv.c Fix memory leaks found under AddressSanitizer 2026-10-14 20:15:01 +03:00
imapp.c per-service timeouts 2026-10-13 15:12:05 +03:00
limiter.c Re-authenticate clients of old services against the new configuration 2026-10-14 23:16:00 +03:00
log.c Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
mainclient.c connect back: a replaced -r service stops waiting at the reload 2026-10-19 16:28:02 +03:00
mainconf.c Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
mainlisten.c Split proxymain.c into its parts 2026-10-18 16:11:46 +03:00
maintcp.c connect back: a replaced -r service stops waiting at the reload 2026-10-19 16:28:02 +03:00
mainudp.c UDP loop: deadlines in a heap, on a monotonic clock 2026-10-22 23:53:06 +03:00
Makefile initial import to git 2014-04-08 13:03:21 +04:00
Makefile.inc Split proxymain.c into its parts 2026-10-18 16:11:46 +03:00
mdhash.c fix wolfSSL build 2026-07-13 20:50:27 +03:00
mdhash.h wolfSSL support added 2026-07-13 20:24:51 +03:00
pcre.c Pre-allocate client/server/tmp/etc buffers with client structure 2026-10-12 17:19:55 +03:00
pcre.h Move PCRE/SSL to main code 2026-05-01 15:11:08 +03:00
plugins.c resolver: the system's name servers and hosts file by default 2026-10-20 18:49:21 +03:00
pop3p.c per-service timeouts 2026-10-13 15:12:05 +03:00
proxy.c proxy: no variable named small, a macro for char on Windows 2026-10-19 16:50:42 +03:00
proxy.h Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
proxymain.c Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
redirect.c resolver: per service, defaultresolve, fakeresolve or sysresolve 2026-10-21 18:45:48 +03:00
resolve.c resolver: per service, defaultresolve, fakeresolve or sysresolve 2026-10-21 18:45:48 +03:00
sem.c Change waiting loops to semaphores for child counters 2026-10-10 23:10:57 +03:00
smtpp.c per-service timeouts 2026-10-13 15:12:05 +03:00
sockgetchar.c sockrecvfrom: poll again when a readable socket has nothing to read 2026-10-22 16:03:21 +03:00
sockmap.c Unix sockets: no addresses on streams, abstract names, tcppm port 0 2026-10-18 12:05:27 +03:00
socks.c resolver: per service, defaultresolve, fakeresolve or sysresolve 2026-10-21 18:45:48 +03:00
sql.c Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
ssl.c TLS: a part of a record read ahead is not pending data 2026-10-22 12:05:02 +03:00
ssl.h TLS: a part of a record read ahead is not pending data 2026-10-22 12:05:02 +03:00
ssllib.c TLS: a part of a record read ahead is not pending data 2026-10-22 12:05:02 +03:00
stringtable.c Name the HTTPSRV service in the string table 2026-10-15 15:36:13 +03:00
structures.h Logs: a logger for each log string, shared and closed once unused 2026-10-23 11:44:55 +03:00
tcppm.c per-service timeouts 2026-10-13 15:12:05 +03:00
tlspr.c per-service timeouts 2026-10-13 15:12:05 +03:00
transparent.c Pre-allocate client/server/tmp/etc buffers with client structure 2026-10-12 17:19:55 +03:00
udppm.c dnspr: name servers asked from the loop, nothing waits in it 2026-10-18 16:50:34 +03:00
udpsockmap.c resolver: per service, defaultresolve, fakeresolve or sysresolve 2026-10-21 18:45:48 +03:00
version.h Update version files for 1.0.0 2026-08-22 12:13:00 +00:00
webadmin.c Reload the configuration atomically 2026-10-14 20:15:14 +03:00