2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_SRC_LOGTAGS_H
10 #define SQUID_SRC_LOGTAGS_H
12 #include "CollapsingHistory.h"
14 /// Things that may happen to a transaction while it is being
15 /// processed according to its LOG_* category. Logged as _SUFFIX(es).
16 /// Unlike LOG_* categories, these flags may not be mutually exclusive.
20 /// Update each of this object flags to "set" if the corresponding
21 /// flag of the given object is set
22 void update(const LogTagsErrors
&other
);
24 bool ignored
= false; ///< _IGNORED: the response was not used for anything
25 bool timedout
= false; ///< _TIMEDOUT: terminated due to a lifetime or I/O timeout
26 bool aborted
= false; ///< _ABORTED: other abnormal termination (e.g., I/O error)
29 /** Squid transaction result code/tag set.
31 * These codes indicate how the request was received
32 * and some details about its processing pathway.
34 * see also http://wiki.squid-cache.org/SquidFaq/SquidLogs#Squid_result_codes
35 * for details on particular components.
41 LOG_TCP_REFRESH_UNMODIFIED
, // refresh from origin revalidated existing entry
42 LOG_TCP_REFRESH_FAIL_OLD
, // refresh from origin failed, stale reply sent
43 LOG_TCP_REFRESH_FAIL_ERR
, // refresh from origin failed, error forwarded
44 LOG_TCP_REFRESH_MODIFIED
, // refresh from origin replaced existing entry
45 LOG_TCP_REFRESH
, // refresh from origin started, but still pending
46 LOG_TCP_CLIENT_REFRESH_MISS
,
49 LOG_TCP_SWAPFAIL_MISS
,
56 LOG_TCP_TUNNEL
, // a binary tunnel was established for this transaction
70 explicit LogTags(const LogTags_ot t
) { update(t
); }
72 void update(const LogTags_ot t
);
74 /// compute the status access.log field
75 const char *c_str() const;
77 /// determine if the log tag code indicates a cache HIT
78 bool isTcpHit() const;
80 /// \returns Cache-Status "hit" or "fwd=..." parameter (or nil)
81 const char *cacheStatusSource() const;
83 /// various problems augmenting the primary log tag
87 /// list of string representations for LogTags_ot
88 static const char *Str_
[];
90 public: // XXX: only until client_db.cc stats are redesigned.
92 /// a set of client protocol, cache use, and other transaction outcome tags
93 LogTags_ot oldType
= LOG_TAG_NONE
;
94 /// controls CF tag presence
95 CollapsingHistory collapsingHistory
;
98 /// iterator for LogTags_ot enumeration
99 inline LogTags_ot
&operator++ (LogTags_ot
&aLogType
)
101 int tmp
= (int)aLogType
;
102 aLogType
= (LogTags_ot
)(++tmp
);