#include "log/ModUdp.h"
#include "log/TcpLogger.h"
-CBDATA_TYPE(Logfile);
+CBDATA_CLASS_INIT(Logfile);
+
+Logfile::Logfile(const char *aPath) :
+ sequence_number(0),
+ data(NULL),
+ f_linestart(NULL),
+ f_linewrite(NULL),
+ f_lineend(NULL),
+ f_flush(NULL),
+ f_rotate(NULL),
+ f_close(NULL)
+{
+ xstrncpy(path, aPath, sizeof(path));
+ flags.fatal = 0;
+}
Logfile *
logfileOpen(const char *path, size_t bufsz, int fatal_flag)
const char *patharg;
debugs(50, DBG_IMPORTANT, "Logfile: opening log " << path);
- CBDATA_INIT_TYPE(Logfile);
- Logfile *lf = cbdataAlloc(Logfile);
- xstrncpy(lf->path, path, MAXPATHLEN);
+ Logfile *lf = new Logfile(path);
patharg = path;
/* need to call the per-logfile-type code */
if (strncmp(path, "stdio:", 6) == 0) {
else
debugs(50, DBG_IMPORTANT, "logfileOpen: " << path << ": couldn't open!");
lf->f_close(lf);
- cbdataFree(lf);
+ delete lf;
return NULL;
}
assert(lf->data != NULL);
debugs(50, DBG_IMPORTANT, "Logfile: closing log " << lf->path);
lf->f_flush(lf);
lf->f_close(lf);
- cbdataFree(lf);
+ delete lf;
}
void
#ifndef SQUID_SRC_LOG_FILE_H
#define SQUID_SRC_LOG_FILE_H
+#include "cbdata.h"
#include "dlink.h"
#if HAVE_SYS_PARAM_H
class Logfile
{
+ CBDATA_CLASS(Logfile);
public:
+ explicit Logfile(const char *aPath);
+ ~Logfile() {}
+
char path[MAXPATHLEN];
struct {