Re: mapping of ecap LogVerbosity to debug_options levels

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Sat, 01 Dec 2012 17:11:29 -0700

On 11/30/2012 08:49 PM, carteriii wrote:
> The logging functionality of the ecap adapter allows users to specify a
> "LogVerbosity" which is a mask of Importance, Frequency, and Message Size:
>
> enum ImportanceLevel { ilDebug = 0, ilNormal = 1, ilCritical = 2 }; // 0xF
> enum FrequencyLevel { flOperation = 0, flXaction = 1 << 4, flApplication = 2
> << 4}; // 0xF0
> enum MessageSizeLevel { mslNormal = 0, mslLarge = 1 << 8 }; // 0xF00
>
> Could someone tell me how these relate to Squid's debug_options levels of
> 1-9?

The mapping from libecap::LogVerbosity to Squid debugging levels is done
by the following Squid function in src/adaptation/ecap/Host.cc:

> static int
> SquidLogLevel(libecap::LogVerbosity lv)
> {
> if (lv.critical())
> return DBG_CRITICAL; // is it a good idea to ignore other flags?
>
> if (lv.large())
> return DBG_DATA; // is it a good idea to ignore other flags?
>
> if (lv.application())
> return DBG_IMPORTANT; // is it a good idea to ignore other flags?
>
> return 2 + 2*lv.debugging() + 3*lv.operation() + 2*lv.xaction();
> }

The mapping algorithm is far from perfect, of course, especially the
last line. Improvements are welcomed, but please keep it simple.

HTH,

Alex.
Received on Sun Dec 02 2012 - 00:11:34 MST

This archive was generated by hypermail 2.2.0 : Sun Dec 02 2012 - 12:00:08 MST