]> git.ipfire.org Git - thirdparty/squid.git/blob - src/log/Config.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / log / Config.cc
1 /*
2 * Copyright (C) 1996-2017 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 #include "squid.h"
10 #include "cache_cf.h"
11 #include "ConfigParser.h"
12 #include "Debug.h"
13 #include "log/Config.h"
14
15 Log::LogConfig Log::TheConfig;
16
17 void
18 Log::LogConfig::parseFormats()
19 {
20 char *name, *def;
21
22 if (!(name = ConfigParser::NextToken())) {
23 self_destruct();
24 }
25
26 ::Format::Format *nlf = new ::Format::Format(name);
27
28 ConfigParser::EnableMacros();
29 if (!(def = ConfigParser::NextQuotedOrToEol())) {
30 delete nlf;
31 self_destruct();
32 return;
33 }
34 ConfigParser::DisableMacros();
35
36 debugs(3, 2, "Log Format for '" << name << "' is '" << def << "'");
37
38 if (!nlf->parse(def)) {
39 delete nlf;
40 self_destruct();
41 return;
42 }
43
44 // add to global config list
45 nlf->next = logformats;
46 logformats = nlf;
47 }
48