]> git.ipfire.org Git - thirdparty/squid.git/blob - src/log/Config.cc
Merged from trunk
[thirdparty/squid.git] / src / log / Config.cc
1 /*
2 * Copyright (C) 1996-2014 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()) == NULL)
23 self_destruct();
24
25 ::Format::Format *nlf = new ::Format::Format(name);
26
27 ConfigParser::EnableMacros();
28 if ((def = ConfigParser::NextQuotedOrToEol()) == NULL) {
29 self_destruct();
30 return;
31 }
32 ConfigParser::DisableMacros();
33
34 debugs(3, 2, "Log Format for '" << name << "' is '" << def << "'");
35
36 if (!nlf->parse(def)) {
37 self_destruct();
38 return;
39 }
40
41 // add to global config list
42 nlf->next = logformats;
43 logformats = nlf;
44 }
45