FormattedLog.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#ifndef SQUID_LOG_FORMATTEDLOG_H_
10#define SQUID_LOG_FORMATTEDLOG_H_
11
12#include "acl/forward.h"
13#include "log/Formats.h"
14#include "log/forward.h"
15
16#include <iosfwd>
17#include <optional>
18
19class ConfigParser;
20
25{
26public:
27 FormattedLog() = default;
29
30 FormattedLog(FormattedLog &&) = delete; // no need to support copying of any kind
31
33 bool usesDaemon() const;
34
37 void parseOptions(ConfigParser&, const char *defaultFormat);
38
40 void dumpOptions(std::ostream &os) const;
41
43 void setLogformat(const char *logformatName);
44
46 void open();
47
49 void rotate();
50
52 void close();
53
55 Logfile *logfile = nullptr;
56
58 char *filename = nullptr;
59
61 ACLList *aclList = nullptr;
62
65
68
70 size_t bufferSize = 8*MAX_URL;
71
73 std::optional<unsigned int> rotationsToKeep;
74
76 bool fatal = true;
77};
78
79#endif /* SQUID_LOG_FORMATTEDLOG_H_ */
80
#define ACLList
Definition: forward.h:46
Log::Format::log_type type
log record template ID
Definition: FormattedLog.h:67
char * filename
logging destination
Definition: FormattedLog.h:58
void close()
stop recording entries
void dumpOptions(std::ostream &os) const
reports explicitly-configured key=value options, in squid.conf format
Definition: FormattedLog.cc:83
void setLogformat(const char *logformatName)
configures formatting-related settings for the given logformat name
bool fatal
whether unrecoverable errors (e.g., dropping a log record) kill worker
Definition: FormattedLog.h:76
void open()
prepare for recording entries
bool usesDaemon() const
Definition: FormattedLog.cc:30
FormattedLog()=default
Format::Format * logFormat
custom log record template for type == Log::Format::CLF_CUSTOM
Definition: FormattedLog.h:64
size_t bufferSize
how much to buffer before dropping or dying (buffer-size=N)
Definition: FormattedLog.h:70
void rotate()
handle the log rotation request
Logfile * logfile
records writer
Definition: FormattedLog.h:55
std::optional< unsigned int > rotationsToKeep
how many log files to retain when rotating. Default: obey logfile_rotate
Definition: FormattedLog.h:73
FormattedLog(FormattedLog &&)=delete
void parseOptions(ConfigParser &, const char *defaultFormat)
Definition: FormattedLog.cc:36
ACLList * aclList
restrict logging to matching transactions
Definition: FormattedLog.h:61
Definition: File.h:39
#define MAX_URL
Definition: defines.h:78
@ CLF_UNKNOWN
Definition: Formats.h:27

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors