]> git.ipfire.org Git - thirdparty/squid.git/blame - src/LogTags.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / LogTags.cc
CommitLineData
53f5404d 1/*
ef57eb7b 2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
53f5404d
AJ
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#include "squid.h"
10#include "LogTags.h"
11
12// old deprecated tag strings
91369933 13const char * LogTags::Str_[] = {
6b38abef
SM
14 "TAG_NONE",
15 "TCP_HIT",
16 "TCP_MISS",
17 "TCP_REFRESH_UNMODIFIED",
18 "TCP_REFRESH_FAIL_OLD",
19 "TCP_REFRESH_FAIL_ERR",
20 "TCP_REFRESH_MODIFIED",
21 "TCP_CLIENT_REFRESH_MISS",
22 "TCP_IMS_HIT",
23 "TCP_SWAPFAIL_MISS",
24 "TCP_NEGATIVE_HIT",
25 "TCP_MEM_HIT",
26 "TCP_DENIED",
27 "TCP_DENIED_REPLY",
28 "TCP_OFFLINE_HIT",
29 "TCP_REDIRECT",
30 "TCP_TUNNEL",
31 "UDP_HIT",
32 "UDP_MISS",
33 "UDP_DENIED",
34 "UDP_INVALID",
35 "UDP_MISS_NOFETCH",
36 "ICP_QUERY",
37 "TYPE_MAX"
53f5404d 38};
91369933 39
a981b360
AJ
40/*
41 * This method is documented in http://wiki.squid-cache.org/SquidFaq/SquidLogs#Squid_result_codes
42 * Please keep the wiki up to date
43 */
91369933
AJ
44const char *
45LogTags::c_str() const
46{
a981b360
AJ
47 static char buf[1024];
48 *buf = 0;
49 int pos = 0;
50
51 // source tags
52 if (oldType && oldType < LOG_TYPE_MAX)
53 pos += snprintf(buf, sizeof(buf), "%s",Str_[oldType]);
54 else
55 pos += snprintf(buf, sizeof(buf), "NONE");
56
57 // error tags
58 if (err.timedout)
59 pos += snprintf(buf+pos,sizeof(buf)-pos, "_TIMEDOUT");
60 if (err.aborted)
61 pos += snprintf(buf+pos,sizeof(buf)-pos, "_ABORTED");
62
63 return buf;
91369933
AJ
64}
65
66bool
67LogTags::isTcpHit() const
68{
69 return
70 (oldType == LOG_TCP_HIT) ||
71 (oldType == LOG_TCP_IMS_HIT) ||
72 (oldType == LOG_TCP_REFRESH_FAIL_OLD) ||
73 (oldType == LOG_TCP_REFRESH_UNMODIFIED) ||
74 (oldType == LOG_TCP_NEGATIVE_HIT) ||
75 (oldType == LOG_TCP_MEM_HIT) ||
76 (oldType == LOG_TCP_OFFLINE_HIT);
77}
6b38abef 78