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_SRC_LOG_FORMATTEDLOG_H
10 #define SQUID_SRC_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 
19 class ConfigParser;
20 
25 {
26 public:
27  FormattedLog() = default;
28  ~FormattedLog();
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_SRC_LOG_FORMATTEDLOG_H */
80 
void setLogformat(const char *logformatName)
configures formatting-related settings for the given logformat name
void open()
prepare for recording entries
char * filename
logging destination
Definition: FormattedLog.h:58
std::optional< unsigned int > rotationsToKeep
how many log files to retain when rotating. Default: obey logfile_rotate
Definition: FormattedLog.h:73
#define MAX_URL
Definition: defines.h:76
Log::Format::log_type type
log record template ID
Definition: FormattedLog.h:67
FormattedLog()=default
@ CLF_UNKNOWN
Definition: Formats.h:27
void rotate()
handle the log rotation request
Definition: File.h:38
ACLList * aclList
restrict logging to matching transactions
Definition: FormattedLog.h:61
size_t bufferSize
how much to buffer before dropping or dying (buffer-size=N)
Definition: FormattedLog.h:70
bool fatal
whether unrecoverable errors (e.g., dropping a log record) kill worker
Definition: FormattedLog.h:76
void parseOptions(ConfigParser &, const char *defaultFormat)
Definition: FormattedLog.cc:36
void dumpOptions(std::ostream &os) const
reports explicitly-configured key=value options, in squid.conf format
Definition: FormattedLog.cc:83
Logfile * logfile
records writer
Definition: FormattedLog.h:55
void close()
stop recording entries
Format::Format * logFormat
custom log record template for type == Log::Format::CLF_CUSTOM
Definition: FormattedLog.h:64
bool usesDaemon() const
Definition: FormattedLog.cc:30

 

Introduction

Documentation

Support

Miscellaneous