#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   t.Text("Log: INFO message. Log: ERROR alert. Log: INFO another message.");

   auto infoRule = t.Pattern("Log: INFO {msg}.").SetTag(1); // Tag 1 for INFO
   auto errorRule = t.Pattern("Log: ERROR {msg}.").SetTag(99); // Tag 99 for ERROR

   t.Find();

   for(auto match : t.Matches()) {
      auto ruleTag = match.Rule().Tag();
      if (ruleTag == 1) {
         cout << "Found informational log: " << match.Text() << endl;
      }
      if (ruleTag == 99) {
         cout << "!!! Found CRITICAL error: " << match.Text() << " !!!" << endl;
      }
   }
}