extracted filtering log code to match() method