#include "squid.h"
#include "cbdata.h"
#include "comm/Loops.h"
#include "fatal.h"
#include "fde.h"
#include "globals.h"
#include "log/Config.h"
#include "log/File.h"
#include "log/ModDaemon.h"
#include "SquidConfig.h"
#include "SquidIpc.h"
#include <cerrno>
Go to the source code of this file.
Classes | |
struct | _l_daemon |
Macros | |
#define | LOGFILE_MAXBUFS 128 |
#define | LOGFILE_BUFSZ 32768 |
#define | LOGFILE_WARN_TIME 30 |
Typedefs | |
typedef struct _l_daemon | l_daemon_t |
Functions | |
static void | logfile_mod_daemon_append (Logfile *lf, const char *buf, int len) |
static void | logfileNewBuffer (Logfile *lf) |
static void | logfileFreeBuffer (Logfile *lf, logfile_buffer_t *b) |
static void | logfileHandleWrite (int, void *data) |
static void | logfileQueueWrite (Logfile *lf) |
static void | logfileFlushEvent (void *data) |
int | logfile_mod_daemon_open (Logfile *lf, const char *path, size_t, int) |
static void | logfile_mod_daemon_close (Logfile *lf) |
static void | logfile_mod_daemon_rotate (Logfile *lf, const int16_t) |
static void | logfile_mod_daemon_writeline (Logfile *lf, const char *buf, size_t len) |
static void | logfile_mod_daemon_linestart (Logfile *lf) |
static void | logfile_mod_daemon_lineend (Logfile *lf) |
static void | logfile_mod_daemon_flush (Logfile *lf) |
Variables | |
static LOGWRITE | logfile_mod_daemon_writeline |
static LOGLINESTART | logfile_mod_daemon_linestart |
static LOGLINEEND | logfile_mod_daemon_lineend |
static LOGROTATE | logfile_mod_daemon_rotate |
static LOGFLUSH | logfile_mod_daemon_flush |
static LOGCLOSE | logfile_mod_daemon_close |
Macro Definition Documentation
◆ LOGFILE_BUFSZ
#define LOGFILE_BUFSZ 32768 |
Definition at line 32 of file ModDaemon.cc.
◆ LOGFILE_MAXBUFS
#define LOGFILE_MAXBUFS 128 |
Definition at line 26 of file ModDaemon.cc.
◆ LOGFILE_WARN_TIME
#define LOGFILE_WARN_TIME 30 |
Definition at line 35 of file ModDaemon.cc.
Typedef Documentation
◆ l_daemon_t
typedef struct _l_daemon l_daemon_t |
Definition at line 56 of file ModDaemon.cc.
Function Documentation
◆ logfile_mod_daemon_append()
Definition at line 163 of file ModDaemon.cc.
References assert, _l_daemon::bufs, dlink_node::data, Logfile::data, debugs, dlink_list::head, LOGFILE_BUFSZ, logfileNewBuffer(), min(), Logfile::path, and dlink_list::tail.
Referenced by logfile_mod_daemon_open(), logfile_mod_daemon_rotate(), logfile_mod_daemon_writeline(), and logfileQueueWrite().
◆ logfile_mod_daemon_close()
|
static |
Definition at line 253 of file ModDaemon.cc.
References cbdataInternalUnlock(), comm_close, Logfile::data, DBG_IMPORTANT, debugs, eventDelete(), logfileFlush(), logfileFlushEvent(), Logfile::path, _l_daemon::pid, _l_daemon::rfd, _l_daemon::wfd, and xfree.
◆ logfile_mod_daemon_flush()
|
static |
Definition at line 336 of file ModDaemon.cc.
References _l_daemon::bufs, commSetNonBlocking(), commUnsetNonBlocking(), Logfile::data, DBG_IMPORTANT, debugs, fatalf(), dlink_list::head, logfileHandleWrite(), Logfile::path, and _l_daemon::wfd.
◆ logfile_mod_daemon_lineend()
|
static |
Definition at line 320 of file ModDaemon.cc.
References SquidConfig::buffered_logs, _l_daemon::bufs, Config, dlink_node::data, Logfile::data, _l_daemon::eol, dlink_list::head, logfileQueueWrite(), dlink_node::next, logfile_buffer_t::node, and SquidConfig::onoff.
◆ logfile_mod_daemon_linestart()
|
static |
Definition at line 312 of file ModDaemon.cc.
References assert, Logfile::data, and _l_daemon::eol.
◆ logfile_mod_daemon_open()
Definition at line 210 of file ModDaemon.cc.
References SquidConfig::buffered_logs, BUFSIZ, cbdataInternalLock(), Config, Logfile::data, DBG_IMPORTANT, debugs, _l_daemon::eol, eventAdd(), Logfile::f_close, Logfile::f_flush, Logfile::f_lineend, Logfile::f_linestart, Logfile::f_linewrite, Logfile::f_rotate, fatal(), IPC_STREAM, ipcCreate(), SquidConfig::Log, logfile_mod_daemon_append(), logfile_mod_daemon_close, logfile_mod_daemon_flush, logfile_mod_daemon_lineend, logfile_mod_daemon_linestart, logfile_mod_daemon_rotate, logfile_mod_daemon_writeline, logfileFlushEvent(), _l_daemon::nbufs, SquidConfig::onoff, _l_daemon::pid, _l_daemon::rfd, SquidConfig::rotateNumber, Ip::Address::setLocalhost(), Log::TheConfig, _l_daemon::wfd, xcalloc(), xfree, and xmalloc.
Referenced by logfileOpen().
◆ logfile_mod_daemon_rotate()
|
static |
Definition at line 272 of file ModDaemon.cc.
References DBG_IMPORTANT, debugs, logfile_mod_daemon_append(), and Logfile::path.
◆ logfile_mod_daemon_writeline()
Definition at line 289 of file ModDaemon.cc.
References Logfile::data, DBG_IMPORTANT, debugs, _l_daemon::eol, _l_daemon::last_warned, LOGFILE_MAXBUFS, logfile_mod_daemon_append(), LOGFILE_WARN_TIME, _l_daemon::nbufs, Logfile::path, and squid_curtime.
◆ logfileFlushEvent()
|
static |
Definition at line 195 of file ModDaemon.cc.
References eventAdd(), logfileFlushEvent(), and logfileQueueWrite().
Referenced by logfile_mod_daemon_close(), logfile_mod_daemon_open(), and logfileFlushEvent().
◆ logfileFreeBuffer()
|
static |
Definition at line 79 of file ModDaemon.cc.
References assert, logfile_buffer_t::buf, _l_daemon::bufs, Logfile::data, dlinkDelete(), _l_daemon::nbufs, logfile_buffer_t::node, and xfree.
Referenced by logfileHandleWrite().
◆ logfileHandleWrite()
|
static |
Definition at line 90 of file ModDaemon.cc.
References assert, logfile_buffer_t::buf, _l_daemon::bufs, COMM_SELECT_WRITE, dlink_node::data, Logfile::data, DBG_IMPORTANT, debugs, fatal(), FD_WRITE_METHOD(), _l_daemon::flush_pending, dlink_list::head, ignoreErrno(), logfile_buffer_t::len, logfileFreeBuffer(), logfileHandleWrite(), Logfile::path, Comm::SetSelect(), _l_daemon::wfd, logfile_buffer_t::written_len, and xstrerr().
Referenced by logfile_mod_daemon_flush(), logfileHandleWrite(), and logfileQueueWrite().
◆ logfileNewBuffer()
|
static |
Definition at line 60 of file ModDaemon.cc.
References assert, _l_daemon::bufs, Logfile::data, debugs, dlinkAddTail(), LOGFILE_BUFSZ, _l_daemon::nbufs, Logfile::path, and xcalloc().
Referenced by logfile_mod_daemon_append().
◆ logfileQueueWrite()
|
static |
Definition at line 146 of file ModDaemon.cc.
References _l_daemon::bufs, COMM_SELECT_WRITE, dlink_node::data, Logfile::data, _l_daemon::flush_pending, dlink_list::head, logfile_buffer_t::len, logfile_mod_daemon_append(), logfileHandleWrite(), Comm::SetSelect(), logfile_buffer_t::size, and _l_daemon::wfd.
Referenced by logfile_mod_daemon_lineend(), and logfileFlushEvent().
Variable Documentation
◆ logfile_mod_daemon_close
|
static |
Definition at line 42 of file ModDaemon.cc.
Referenced by logfile_mod_daemon_open().
◆ logfile_mod_daemon_flush
|
static |
Definition at line 41 of file ModDaemon.cc.
Referenced by logfile_mod_daemon_open().
◆ logfile_mod_daemon_lineend
|
static |
Definition at line 39 of file ModDaemon.cc.
Referenced by logfile_mod_daemon_open().
◆ logfile_mod_daemon_linestart
|
static |
Definition at line 38 of file ModDaemon.cc.
Referenced by logfile_mod_daemon_open().
◆ logfile_mod_daemon_rotate
|
static |
Definition at line 40 of file ModDaemon.cc.
Referenced by logfile_mod_daemon_open().
◆ logfile_mod_daemon_writeline
|
static |
Definition at line 37 of file ModDaemon.cc.
Referenced by logfile_mod_daemon_open().