]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
4ac4a490 | 2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
bbc27441 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 | ||
582c2af2 | 9 | #include "squid.h" |
3ff65596 | 10 | #include "AccessLogEntry.h" |
8ebad780 | 11 | #include "acl/FilledChecklist.h" |
8ebad780 | 12 | #include "globals.h" |
602d9612 A |
13 | #include "HttpReply.h" |
14 | #include "icap_log.h" | |
8f645002 | 15 | #include "log/CustomLog.h" |
82b7abe3 | 16 | #include "log/File.h" |
20efa1c2 | 17 | #include "log/Formats.h" |
4d5904f7 | 18 | #include "SquidConfig.h" |
3ff65596 AR |
19 | |
20 | int IcapLogfileStatus = LOG_DISABLE; | |
21 | ||
22 | void | |
23 | icapLogOpen() | |
24 | { | |
87ddff6e | 25 | CustomLog *log; |
3ff65596 AR |
26 | |
27 | for (log = Config.Log.icaplogs; log; log = log->next) { | |
20efa1c2 | 28 | if (log->type == Log::Format::CLF_NONE) |
3ff65596 AR |
29 | continue; |
30 | ||
fb0c2f17 | 31 | log->logfile = logfileOpen(log->filename, log->bufferSize, log->fatal); |
3ff65596 AR |
32 | |
33 | IcapLogfileStatus = LOG_ENABLE; | |
34 | } | |
35 | } | |
36 | ||
e1381638 | 37 | void |
3ff65596 AR |
38 | icapLogClose() |
39 | { | |
87ddff6e | 40 | CustomLog *log; |
3ff65596 AR |
41 | |
42 | for (log = Config.Log.icaplogs; log; log = log->next) { | |
43 | if (log->logfile) { | |
44 | logfileClose(log->logfile); | |
45 | log->logfile = NULL; | |
46 | } | |
47 | } | |
48 | } | |
49 | ||
50 | void | |
51 | icapLogRotate() | |
52 | { | |
87ddff6e | 53 | for (CustomLog* log = Config.Log.icaplogs; log; log = log->next) { |
3ff65596 | 54 | if (log->logfile) { |
efc23871 | 55 | logfileRotate(log->logfile, Config.Log.rotateNumber); |
3ff65596 AR |
56 | } |
57 | } | |
58 | } | |
59 | ||
8ebad780 | 60 | void icapLogLog(AccessLogEntry::Pointer &al) |
3ff65596 | 61 | { |
8ebad780 CT |
62 | if (IcapLogfileStatus == LOG_ENABLE) { |
63 | ACLFilledChecklist checklist(NULL, al->adapted_request, NULL); | |
64 | if (al->reply) { | |
65 | checklist.reply = al->reply; | |
66 | HTTPMSGLOCK(checklist.reply); | |
67 | } | |
68 | accessLogLogTo(Config.Log.icaplogs, al, &checklist); | |
69 | } | |
3ff65596 | 70 | } |
f53969cc | 71 |