Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "LogObject.h"
00025 #include "LogConfig.h"
00026 #include "LogFormat.h"
00027 #include "LogPredefined.h"
00028
00029
00030 const char * const PreDefinedFormatInfo::squid =
00031 "%<cqtq> %<ttms> %<chi> %<crc>/%<pssc> %<psql> %<cqhm> %<cquc> %<caun> %<phr>/%<pqsn> %<psct>";
00032
00033 const char * const PreDefinedFormatInfo::common =
00034 "%<chi> - %<caun> [%<cqtn>] \"%<cqtx>\" %<pssc> %<pscl>";
00035
00036 const char * const PreDefinedFormatInfo::extended =
00037 "%<chi> - %<caun> [%<cqtn>] \"%<cqtx>\" %<pssc> %<pscl> "
00038 "%<sssc> %<sscl> %<cqbl> %<pqbl> %<cqhl> %<pshl> %<pqhl> %<sshl> %<tts>";
00039
00040 const char * const PreDefinedFormatInfo::extended2 =
00041 "%<chi> - %<caun> [%<cqtn>] \"%<cqtx>\" %<pssc> %<pscl> "
00042 "%<sssc> %<sscl> %<cqbl> %<pqbl> %<cqhl> %<pshl> %<pqhl> %<sshl> %<tts> %<phr> %<cfsc> %<pfsc> %<crc>";
00043
00044 PreDefinedFormatInfo *
00045 MakePredefinedErrorLog(LogConfig * config)
00046 {
00047 LogFormat * fmt;
00048
00049 fmt = MakeTextLogFormat("error");
00050 config->global_format_list.add(fmt, false);
00051
00052
00053 return new PreDefinedFormatInfo(fmt, "error.log", NULL , LOG_FILE_ASCII, false);
00054 }
00055
00056 PreDefinedFormatList::PreDefinedFormatList()
00057 {
00058 }
00059
00060 PreDefinedFormatList::~PreDefinedFormatList()
00061 {
00062 PreDefinedFormatInfo * info;
00063 while (!this->formats.empty()) {
00064 info = this->formats.pop();
00065 delete info;
00066 }
00067 }
00068
00069 void
00070 PreDefinedFormatList::init(LogConfig * config)
00071 {
00072 LogFormat * fmt;
00073
00074
00075
00076 #define make_format(is_ascii) ((is_ascii) ? LOG_FILE_ASCII : LOG_FILE_BINARY )
00077
00078 fmt = new LogFormat("squid", PreDefinedFormatInfo::squid);
00079 config->global_format_list.add(fmt, false);
00080 Debug("log", "squid format added to the global format list");
00081
00082 if (config->squid_log_enabled) {
00083 this->formats.enqueue(new PreDefinedFormatInfo(fmt, config->squid_log_name, config->squid_log_header, make_format(config->squid_log_is_ascii), true));
00084 }
00085
00086 fmt = new LogFormat("common", PreDefinedFormatInfo::common);
00087 config->global_format_list.add(fmt, false);
00088 Debug("log", "common format added to the global format list");
00089
00090 if (config->common_log_enabled) {
00091 this->formats.enqueue(new PreDefinedFormatInfo(fmt, config->common_log_name, config->common_log_header, make_format(config->common_log_is_ascii), true));
00092 }
00093
00094 fmt = new LogFormat("extended", PreDefinedFormatInfo::extended);
00095 config->global_format_list.add(fmt, false);
00096 Debug("log", "extended format added to the global format list");
00097
00098 if (config->extended_log_enabled) {
00099 this->formats.enqueue(new PreDefinedFormatInfo(fmt, config->extended_log_name, config->extended_log_header, make_format(config->extended_log_is_ascii), true));
00100 }
00101
00102 fmt = new LogFormat("extended2", PreDefinedFormatInfo::extended2);
00103 config->global_format_list.add(fmt, false);
00104 Debug("log", "extended2 format added to the global format list");
00105
00106 if (config->extended2_log_enabled) {
00107 this->formats.enqueue(new PreDefinedFormatInfo(fmt, config->extended2_log_name, config->extended2_log_header, make_format(config->extended2_log_is_ascii), true));
00108 }
00109
00110 #undef make_format
00111 }
00112