MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / GetDescription

Method GetDescription

source/messmatch.cpp:164–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162char * szAllMessMatch = "All messages match";
163
164String TMessMatch::GetDescription(void)
165{
166 String rv;
167 String t;
168
169 if( PriorityMask != PriorityMaskAll ) // filter by priority enable
170 {
171 int c=0;
172 t = "";
173 for(int pri=0; pri<LOG_NPRIORITIES; pri++)
174 if( (1<<pri) & PriorityMask )
175 {
176 if( c++ > 0 )
177 t += " OR ";
178 t += getcodetext(pri, prioritynames);
179 }
180 if( c > 1 )
181 t = String("(") + t + ")";
182 rv += String("Priority = ") + t;
183 }
184
185 if( FacilityMask != FacilityMaskAll ) // filter by priority enable
186 {
187 if( rv.Length() > 0 ) rv += " AND ";
188 int c=0;
189 t = "";
190 for(int fac=0; fac<LOG_NFACILITIES; fac++)
191 if( (1<<fac) & FacilityMask )
192 {
193 if( c++ > 0 )
194 t += " OR ";
195 t += getcodetext(fac<<3, facilitynames);
196 }
197 if( c > 1 )
198 t = String("(") + t + ")";
199 rv += String("Facility = ") + t;
200 }
201
202 if( Text1->Count > 0 )
203 {
204 t = GetDelimitedText(Text1, "\" OR \"");
205 if( rv.Length() > 0 ) rv += " AND ";
206 switch( Field1 )
207 {
208 case 0: // Text contains
209 rv += String("Text ") + (Contains1 ? "" : "NOT ") + "contains \"" + t + "\"";
210 break;
211 case 1: // Message text contains
212 rv += String("Message ") + (Contains1 ? "" : "NOT ") + "contains \"" + t + "\"";
213 break;
214 case 2: // IP =
215 rv += String("IP") + (Contains1 ? " = " : " <> ") + "\"" + t + "\"";
216 break;
217 case 3: // Host =
218 rv += String("Host") + (Contains1 ? " = " : " <> ") + "\"" + t + "\"";
219 break;
220 case 4: // Facility =
221 rv += String("Facility") + (Contains1 ? " = " : " <> ") + "\"" + t + "\"";

Callers

nothing calls this directly

Calls 1

getcodetextFunction · 0.85

Tested by

no test coverage detected