9#ifndef SQUID_SRC_LOG_TCPLOGGER_H
10#define SQUID_SRC_LOG_TCPLOGGER_H
41 static int Open(
Logfile *lf,
const char *path,
size_t bufSz,
int fatalFlag);
54 void logRecord(
const char *buf,
size_t len);
60 void start()
override;
78 bool canFit(
const size_t len)
const;
80 void appendChunk(
const char *chunk,
const size_t len);
RefCount< MemBlob > MemBlobPointer
bool reconnectScheduled
we are sleeping before the next connection attempt
JobWait< Comm::ConnOpener > connWait
waits for a connection to the remote logger to be established/opened
void writeDone(const CommIoCbParams &io)
Comm::Write callback.
void writeIfNeeded()
starts writing if and only if it is time to write accumulated records
void disconnect()
close our connection now, without flushing
void logRecord(const char *buf, size_t len)
buffers record and possibly writes it to the remote logger
bool quitOnEmpty
whether this job should quit when buffers are empty
void writeIfPossible()
starts writing if possible
bool writeScheduled
we are waiting for the latest write() results
static void EndLine(Logfile *lf)
bool canFit(const size_t len) const
whether len more bytes can be buffered
void appendChunk(const char *chunk, const size_t len)
buffer a record chunk without splitting it across buffers
static void Flush(Logfile *lf)
void delayedReconnect()
"sleep a little before trying to connect again" event callback
size_t flushDebt
how many record bytes we still need to write ASAP
static void DelayedReconnect(void *data)
Log::TcpLogger::delayedReconnect() wrapper.
uint64_t connectFailures
number of sequential connection failures
static TcpLogger * StillLogging(Logfile *lf)
void handleClosure(const CommCloseCbParams &io)
Ip::Address remote
where the remote logger expects our records
CbcPointer< TcpLogger > Pointer
AsyncCall::Pointer closer
handles unexpected/external conn closures
static void WriteLine(Logfile *lf, const char *buf, size_t len)
Comm::ConnectionPointer conn
opened connection to the remote logger
static void Close(Logfile *lf)
void doConnect()
starts [re]connecting to the remote logger
static const size_t IoBufSize
fixed I/O buffer size
static const size_t BufferCapacityMin
minimum bufferCapacity value
void connectDone(const CommConnectCbParams &conn)
Comm::ConnOpener callback.
size_t bufferedSize
number of log record bytes stored in RAM now
bool doneAll() const override
whether positive goal has been reached
void appendRecord(const char *buf, size_t len)
buffer a record that might exceed IoBufSize
uint64_t drops
number of records dropped during the current outage
std::list< MemBlobPointer > buffers
I/O buffers.
static int Open(Logfile *lf, const char *path, size_t bufSz, int fatalFlag)
void flush()
write all currently buffered records ASAP
size_t bufferCapacity
bufferedSize limit
static void Rotate(Logfile *lf, const int16_t)
static void StartLine(Logfile *lf)
void start() override
called by AsyncStart; do not call directly