3
A brief file description
5
@section license License
7
Licensed to the Apache Software Foundation (ASF) under one
8
or more contributor license agreements. See the NOTICE file
9
distributed with this work for additional information
10
regarding copyright ownership. The ASF licenses this file
11
to you under the Apache License, Version 2.0 (the
12
"License"); you may not use this file except in compliance
13
with the License. You may obtain a copy of the License at
15
http://www.apache.org/licenses/LICENSE-2.0
17
Unless required by applicable law or agreed to in writing, software
18
distributed under the License is distributed on an "AS IS" BASIS,
19
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
See the License for the specific language governing permissions and
21
limitations under the License.
29
#define LOG_FIELD_MARKER '\377'
33
#include "LogFormatType.h"
36
/*-------------------------------------------------------------------------
39
Ok, as of 3.1, the role of the LogFormat object changes greatly. Before
40
it was the central object in the logging system that defined each "file"
41
that would be created, and all other objects hung off of it.
43
Now, this object will simply store the characteristics of a log format,
44
which is defined as a set of fields.
45
-------------------------------------------------------------------------*/
50
LogFormat(LogFormatType type);
51
LogFormat(const char *name, const char *format_str, unsigned interval_sec = 0);
52
LogFormat(const char *name, const char *fieldlist_str, const char *printf_str, unsigned interval_sec = 0);
53
LogFormat(const LogFormat & rhs);
56
void display(FILE * fd = stdout);
57
void displayAsXML(FILE * fd = stdout);
69
return m_fieldlist_str;
79
unsigned fieldlist_id()
81
return m_fieldlist_id;
95
unsigned field_count()
101
return m_interval_sec;
105
static int32_t id_from_name(const char *name);
106
static LogFormat *format_from_specification(char *spec,
107
char **file_name, char **file_header, LogFileFormat * file_type);
108
static int parse_symbol_string(const char *symbol_string, LogFieldList *field_list, bool *contains_aggregates);
109
static int parse_format_string(const char *format_str, char **printf_str, char **fields_str);
111
// these are static because m_tagging_on is a class variable
113
static void turn_tagging_on()
117
static void turn_tagging_off()
119
m_tagging_on = false;
123
void setup(const char *name, const char *format_str, unsigned interval_sec = 0);
124
void init_variables(const char *name, const char *fieldlist_str, const char *printf_str, unsigned interval_sec);
127
LogFieldList m_field_list;
129
long m_interval_next;
130
char *m_agg_marshal_space;
132
static const char *const squid_format; // pre defined formats
133
static const char *const common_format;
134
static const char *const extended_format;
135
static const char *const extended2_format;
138
static bool m_tagging_on; // flag to control tagging, class
143
char *m_fieldlist_str;
144
unsigned m_fieldlist_id;
145
unsigned m_field_count;
149
LogFormatType m_format_type;
152
LINK(LogFormat, link);
155
// -- member functions that are not allowed --
157
LogFormat & operator=(LogFormat & rhs);
160
/*-------------------------------------------------------------------------
162
-------------------------------------------------------------------------*/
170
void add(LogFormat * format, bool copy = true);
171
LogFormat *find_by_name(const char *name) const;
172
LogFormat *find_by_type(LogFormatType type, int32_t id) const;
174
LogFormat *first() const
176
return m_format_list.head;
178
LogFormat *next(LogFormat * here) const
180
return (here->link).next;
184
void display(FILE * fd = stdout);
186
Queue<LogFormat> m_format_list;
188
// -- member functions that are not allowed --
189
LogFormatList(const LogFormatList & rhs);
190
LogFormatList & operator=(const LogFormatList & rhs);