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

Method LocalMatch

source/messmatch.cpp:48–88  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

46}
47//---------------------------------------------------------------------------
48bool TMessMatch::LocalMatch(TSyslogMessage * p)
49{
50 if( p->PRI != -1 ) // priority and facility value exist in message
51 {
52 if( ((1<<LOG_PRI(p->PRI)) & PriorityMask) == 0 )
53 return false;
54 if( ((1<<LOG_FAC(p->PRI)) & FacilityMask) == 0 )
55 return false;
56 }
57
58 // rule 1
59 bool b = true;
60 for(int i=0; i<Text1->Count; i++)
61 {
62 if( MatchAllFilds(p, Field1, Contains1, Text1->Strings[i]) )
63 {
64 b = true;
65 break;
66 }
67 b = false;
68 }
69 // strings count > 0 and all strings not match
70 if( ! b )
71 return false;
72
73 // rule 2
74 b = true;
75 for(int i=0; i<Text2->Count; i++)
76 {
77 if( MatchAllFilds(p, Field2, Contains2, Text2->Strings[i]) )
78 {
79 b = true;
80 break;
81 }
82 b = false;
83 }
84 if( ! b )
85 return false;
86
87 return true;
88}
89//---------------------------------------------------------------------------
90bool TMessMatch::MatchAllFilds(TSyslogMessage * p, int Field, bool Contains,
91 String Text)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected