Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
event-log.hpp
Go to the documentation of this file.
1 /*
2  EVENT-LOG.hpp - test facility to verify the occurrence of expected events
3 
4  Copyright (C) Lumiera.org
5  2015, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
42 #ifndef LIB_TEST_EVENT_LOG_H
43 #define LIB_TEST_EVENT_LOG_H
44 
45 
46 #include "lib/error.hpp"
47 #include "lib/idi/entry-id.hpp"
48 #include "lib/iter-adapter.hpp"
49 #include "lib/iter-cursor.hpp"
50 #include "lib/format-util.hpp"
51 #include "lib/format-cout.hpp"
52 #include "lib/diff/record.hpp"
53 #include "lib/symbol.hpp"
54 #include "lib/util.hpp"
55 
56 #include <memory>
57 #include <vector>
58 #include <string>
59 #include <regex>
60 
61 
62 
63 namespace lib {
64 namespace test{
65  namespace error = lumiera::error;
66 
67  using util::stringify;
68  using util::contains;
69  using util::isnil;
70  using lib::Symbol;
71  using std::string;
72 
73 
74 
84  class EventMatch
85  {
87  using Log = std::vector<Entry>;
90 
92  using RExSeq = std::vector<std::regex>;
93 
94 
97 
99  string lastMatch_;
100 
103 
105  string violation_;
106 
111  bool
113  {
114  return !isnil (solution_);
115  }
116 
126  void
127  evaluateQuery (string matchSpec, Literal rel = "after")
128  {
129  if (look_for_match_ and not isnil (violation_)) return;
130  // already failed, no further check necessary
131 
132  if (foundSolution())
133  {
134  lastMatch_ = matchSpec+" @ "+string(*solution_)
135  + (isnil(lastMatch_)? ""
136  : "\n.."+rel+" "+lastMatch_);
137  if (not look_for_match_)
138  violation_ = "FOUND at least "+lastMatch_;
139  }
140  else
141  {
142  if (look_for_match_)
143  violation_ = "FAILED to "+matchSpec
144  + "\n.."+rel
145  + " "+lastMatch_;
146  else
147  violation_ = "";
148  }
149  }
150 
151 
153  EventMatch(Log const& srcSeq)
154  : solution_(Iter(srcSeq))
155  , lastMatch_("HEAD "+ solution_->get("this"))
156  , look_for_match_(true)
157  , violation_()
158  { }
159 
160  friend class EventLog;
161 
162 
163 
164  /* == elementary matchers == */
165 
166  auto
167  find (string match)
168  {
169  return [=](Entry const& entry)
170  {
171  return contains (string(entry), match);
172  };
173  }
174 
175  auto
176  findRegExp (string regExpDef)
177  {
178  std::regex regExp(regExpDef);
179  return [=](Entry const& entry)
180  {
181  return std::regex_search(string(entry), regExp);
182  };
183  }
184 
185  auto
186  findEvent (string match)
187  {
188  return [=](Entry const& entry)
189  {
190  return ( entry.getType() == "event"
191  or entry.getType() == "error"
192  or entry.getType() == "create"
193  or entry.getType() == "destroy"
194  or entry.getType() == "logJoin"
195  )
196  and !isnil(entry.scope())
197  and contains (*entry.scope(), match);
198  };
199  }
200 
201  auto
202  findEvent (string classifier, string match)
203  {
204  return [=](Entry const& entry)
205  {
206  return ( entry.getType() == classifier
207  or (entry.hasAttribute("ID") and contains (entry.get("ID"), classifier))
208  )
209  and !isnil(entry.scope())
210  and contains (*entry.scope(), match);
211  };
212  }
213 
214  auto
215  findCall (string match)
216  {
217  return [=](Entry const& entry)
218  {
219  return entry.getType() == "call"
220  and contains (entry.get("fun"), match);
221  };
222  }
223 
224 
233  auto
235  {
236  return [=](Entry const& entry)
237  {
238  auto scope = entry.scope();
239  for (auto const& match : argSeq)
240  if (isnil (scope) or not contains(*scope, match))
241  return false;
242  else
243  ++scope;
244 
245  return isnil(scope); // must be exhausted by now
246  }; // otherwise the sizes do not match...
247  }
248 
249 
259  auto
260  matchArgsRegExp (RExSeq&& regExpSeq)
261  {
262  return [=](Entry const& entry)
263  {
264  auto scope = entry.scope();
265  for (auto const& rex : regExpSeq)
266  {
267  if (isnil (scope)) return false;
268  while (scope and std::regex_search(*scope, rex))
269  ++scope;
270  }
271 
272  return isnil(scope); // must be exhausted by now
273  }; // otherwise we didn't get full coverage...
274  }
275 
276 
278  auto
279  matchType (string typeID)
280  {
281  return [=](Entry const& entry)
282  {
283  return contains (entry.getType(), typeID);
284  };
285  }
286 
287 
289  auto
291  {
292  return [=](Entry const& entry)
293  {
294  return entry.hasAttribute(key);
295  };
296  }
297 
298 
300  auto
301  matchAttribute (string key, string valueMatch)
302  {
303  return [=](Entry const& entry)
304  {
305  return entry.hasAttribute(key)
306  and contains (entry.get(key), valueMatch);
307  };
308  }
309 
310 
311  public:
316  operator bool() const
317  {
318  if (!isnil (violation_))
319  {
320  cerr << "__Log_condition_violated__\n"+violation_ <<"\n";
321  return false;
322  }
323  return true;
324  }
325 
326 
335  EventMatch&
336  before (string match)
337  {
338  solution_.underlying().switchForwards();
339  solution_.setNewFilter(find(match));
340  evaluateQuery ("match(\""+match+"\")");
341  return *this;
342  }
343 
345  EventMatch&
346  beforeMatch (string regExp)
347  {
348  solution_.underlying().switchForwards();
349  solution_.setNewFilter(findRegExp(regExp));
350  evaluateQuery ("find-RegExp(\""+regExp+"\")");
351  return *this;
352  }
353 
367  EventMatch&
368  beforeEvent (string match)
369  {
370  solution_.underlying().switchForwards();
371  solution_.setNewFilter(findEvent(match));
372  evaluateQuery ("match-event(\""+match+"\")");
373  return *this;
374  }
375 
376  EventMatch&
377  beforeEvent (string classifier, string match)
378  {
379  solution_.underlying().switchForwards();
380  solution_.setNewFilter(findEvent(classifier,match));
381  evaluateQuery ("match-event(ID=\""+classifier+"\", \""+match+"\")");
382  return *this;
383  }
384 
389  EventMatch&
390  beforeCall (string match)
391  {
392  solution_.underlying().switchForwards();
393  solution_.setNewFilter(findCall(match));
394  evaluateQuery ("match-call(\""+match+"\")");
395  return *this;
396  }
397 
398  EventMatch&
399  after (string match)
400  {
401  solution_.underlying().switchBackwards();
402  solution_.setNewFilter(find(match));
403  evaluateQuery ("match(\""+match+"\")", "before");
404  return *this;
405  }
406 
407  EventMatch&
408  afterMatch (string regExp)
409  {
410  solution_.underlying().switchBackwards();
411  solution_.setNewFilter(findRegExp(regExp));
412  evaluateQuery ("find-RegExp(\""+regExp+"\")", "before");
413  return *this;
414  }
415 
416  EventMatch&
417  afterEvent (string match)
418  {
419  solution_.underlying().switchBackwards();
420  solution_.setNewFilter(findEvent(match));
421  evaluateQuery ("match-event(\""+match+"\")", "before");
422  return *this;
423  }
424 
425  EventMatch&
426  afterEvent (string classifier, string match)
427  {
428  solution_.underlying().switchBackwards();
429  solution_.setNewFilter(findEvent(classifier,match));
430  evaluateQuery ("match-event(ID=\""+classifier+"\", \""+match+"\")", "before");
431  return *this;
432  }
433 
435  EventMatch&
436  afterCall (string match)
437  {
438  solution_.underlying().switchBackwards();
439  solution_.setNewFilter(findCall(match));
440  evaluateQuery ("match-call(\""+match+"\")", "before");
441  return *this;
442  }
443 
450  template<typename...ARGS>
451  EventMatch&
452  arg (ARGS const& ...args)
453  {
454  ArgSeq argSeq(stringify<ArgSeq> (args...));
455  string argList(util::join(argSeq));
456 
457  solution_.andFilter (matchArguments(move(argSeq)));
458  evaluateQuery ("match-arguments("+argList+")");
459  return *this;
460  }
461 
472  template<typename...ARGS>
473  EventMatch&
474  argMatch (ARGS const& ...regExps)
475  {
476  solution_.andFilter (matchArgsRegExp (stringify<RExSeq> (regExps...)));
477  evaluateQuery ("match-args-RegExp("+util::join(stringify<ArgSeq>(regExps...))+")");
478  return *this;
479  }
480 
482  EventMatch&
483  type (string typeID)
484  {
485  solution_.andFilter (matchType(typeID));
486  evaluateQuery ("match-type("+typeID+")");
487  return *this;
488  }
489 
491  EventMatch&
492  key (string key)
493  {
494  solution_.andFilter (ensureAttribute(key));
495  evaluateQuery ("ensure-attribute("+key+")");
496  return *this;
497  }
498 
500  EventMatch&
501  attrib (string key, string valueMatch)
502  {
503  solution_.andFilter (matchAttribute(key,valueMatch));
504  evaluateQuery ("match-attribute("+key+"=\""+valueMatch+"\")");
505  return *this;
506  }
507 
509  EventMatch&
510  id (string classifier)
511  {
512  solution_.andFilter (matchAttribute("ID",classifier));
513  evaluateQuery ("match-ID(\""+classifier+"\")");
514  return *this;
515  }
516 
518  EventMatch&
519  on (string targetID)
520  {
521  solution_.andFilter (matchAttribute("this",targetID));
522  evaluateQuery ("match-this(\""+targetID+"\")");
523  return *this;
524  }
525 
526  EventMatch&
527  on (const char* targetID)
528  {
529  solution_.andFilter (matchAttribute("this",targetID));
530  evaluateQuery ("match-this(\""+string(targetID)+"\")");
531  return *this;
532  }
533 
534  template<typename X>
535  EventMatch&
536  on (const X *const targetObj)
537  {
538  string targetID = idi::instanceTypeID (targetObj);
539  solution_.andFilter (matchAttribute("this",targetID));
540  evaluateQuery ("match-this(\""+targetID+"\")");
541  return *this;
542  }
543  };
544 
545 
546 
547 
548 
549  /****************************************************************/
557  class EventLog
558  {
560  using Log = std::vector<Entry>;
562 
564 
565 
566  void
567  log (std::initializer_list<string> const& ili)
568  {
569  log_->emplace_back(ili);
570  }
571 
572  template<typename ATTR, typename ARGS>
573  void
574  log (Symbol typeID, ATTR&& attribs, ARGS&& args)
575  {
576  log_->emplace_back(typeID, std::forward<ATTR>(attribs)
577  , std::forward<ARGS>(args));
578  }
579 
580  string
581  getID() const
582  {
583  return log_->front().get("this");
584  }
585 
586 
587  public:
588  explicit
589  EventLog (string logID)
590  : log_(new Log)
591  {
592  log({"type=EventLogHeader", "this="+logID});
593  }
594 
595  explicit
596  EventLog (const char* logID)
597  : EventLog(string(logID))
598  { }
599 
600  template<class X>
601  explicit
602  EventLog (const X *const obj)
603  : EventLog(idi::instanceTypeID (obj))
604  { }
605 
606 
607  // standard copy operations acceptable
608 
609 
626  EventLog&
627  joinInto (EventLog& otherLog)
628  {
629  Log& target = *otherLog.log_;
630  target.reserve (target.size() + log_->size() + 1);
631  target.emplace_back (log_->front());
632  auto p = log_->begin();
633  while (++p != log_->end()) // move our log's content into the other log
634  target.emplace_back(std::move(*p));
635  this->log_->resize(1);
636  this->log({"type=joined", otherLog.getID()}); // leave a tag to indicate
637  otherLog.log({"type=logJoin", this->getID()}); // where the `joinInto` took place,
638  this->log_ = otherLog.log_; // connect this to the other storage
639  return *this;
640  }
641 
642 
644  EventLog&
646  {
647  string originalLogID = this->getID();
648  return this->clear (originalLogID);
649  }
650 
659  EventLog&
660  clear (string alteredLogID)
661  {
662  log_.reset (new Log);
663  log({"type=EventLogHeader", "this="+alteredLogID});
664  return *this;
665  }
666 
667  EventLog&
668  clear (const char* alteredLogID)
669  {
670  return clear (string{alteredLogID});
671  }
672 
673  template<class X>
674  EventLog&
675  clear (const X *const obj)
676  {
677  return clear (idi::instanceTypeID (obj));
678  }
679 
680 
681 
682  /* ==== Logging API ==== */
683 
685 
686  EventLog&
687  event (string text)
688  {
689  log ("event", ArgSeq{}, ArgSeq{text}); // we use this ctor variant to ensure
690  return *this; // that text is not misinterpreted as attribute,
691  } // which might happen when text contains a '='
692 
697  EventLog&
698  event (string classifier, string text)
699  {
700  log ("event", ArgSeq{"ID="+classifier}, ArgSeq{text});
701  return *this;
702  }
703 
708  EventLog&
709  call (string target, string function)
710  {
711  return call(target, function, ArgSeq());
712  }
713 
715  EventLog&
716  call (string target, string function, ArgSeq&& args)
717  {
718  log ("call", ArgSeq{"fun="+function, "this="+target}, std::forward<ArgSeq>(args));
719  return *this;
720  }
721 
722  EventLog&
723  call (const char* target, const char* function, ArgSeq&& args)
724  {
725  return call (string(target), string(function), std::forward<ArgSeq>(args));
726  }
727 
729  template<typename...ARGS>
730  EventLog&
731  call (string target, string function, ARGS const& ...args)
732  {
733  return call (target, function, stringify<ArgSeq>(args...));
734  }
735 
737  template<class X, typename...ARGS>
738  EventLog&
739  call (const X *const targetObj, string function, ARGS const& ...args)
740  {
741  return call (idi::instanceTypeID (targetObj), function, args...);
742  }
743 
744  template<typename...ARGS>
745  EventLog&
746  call (const char* target, string function, ARGS const& ...args)
747  {
748  return call (string(target), function, args...);
749  }
750 
751  template<typename...ELMS>
752  EventLog&
753  note (ELMS const& ...initialiser)
754  {
755  log_->emplace_back(stringify<ArgSeq> (initialiser...));
756  return *this;
757  }
758 
759 
761  EventLog&
762  warn (string text)
763  {
764  log({"type=warn", text});
765  return *this;
766  }
767 
768 
770  EventLog&
771  error (string text)
772  {
773  log({"type=error", text});
774  return *this;
775  }
776 
777 
779  EventLog&
780  fatal (string text)
781  {
782  log({"type=fatal", text});
783  return *this;
784  }
785 
786 
789  EventLog&
790  create (string text)
791  {
792  log({"type=create", text});
793  return *this;
794  }
795 
796 
799  EventLog&
800  destroy (string text)
801  {
802  log({"type=destroy", text});
803  return *this;
804  }
805 
806 
807 
808  /* ==== Iteration ==== */
809 
810  bool
811  empty() const
812  {
813  return 1 >= log_->size(); // do not count the log header
814  }
815 
816 
818  typedef const Entry value_type;
819 
820  const_iterator begin() const { return Iter(log_->begin(), log_->end()); }
821  const_iterator end() const { return Iter(); }
822 
823  friend const_iterator begin (EventLog const& log) { return log.begin(); }
824  friend const_iterator end (EventLog const& log) { return log.end(); }
825 
826 
827 
828 
829  /* ==== Query/Verification API ==== */
830 
838  EventMatch
839  verify (string match) const
840  {
841  EventMatch matcher(*log_);
842  matcher.before (match); // "the start of the log is before the match"
843  return matcher;
844  }
845 
852  EventMatch
853  verifyMatch (string regExp) const
854  {
855  EventMatch matcher(*log_);
856  matcher.beforeMatch (regExp);
857  return matcher;
858  }
859 
867  EventMatch
868  verifyEvent (string match) const
869  {
870  EventMatch matcher(*log_);
871  matcher.beforeEvent (match);
872  return matcher;
873  }
874 
875  EventMatch
876  verifyEvent (string classifier, string match) const
877  {
878  EventMatch matcher(*log_);
879  matcher.beforeEvent (classifier, match);
880  return matcher;
881  }
882 
883  template<typename X>
884  EventMatch
885  verifyEvent (string classifier, X const& something) const
886  {
887  return verifyEvent (classifier, util::toString (something));
888  }
889 
893  EventMatch
894  verifyCall (string match) const
895  {
896  EventMatch matcher(*log_);
897  matcher.beforeCall (match);
898  return matcher;
899  }
900 
906  EventMatch
907  ensureNot (string match) const
908  {
909  EventMatch matcher(*log_);
910  matcher.look_for_match_ = false; // flip logic; fail if match succeeds
911  matcher.before (match);
912  return matcher;
913  }
914 
915 
917  friend bool
918  operator== (EventLog const& l1, EventLog const& l2)
919  {
920  return l1.log_ == l2.log_
921  or (l1.log_ and l2.log_
922  and *l1.log_ == *l2.log_);
923  }
924  friend bool
925  operator!= (EventLog const& l1, EventLog const& l2)
926  {
927  return not (l1 == l2);
928  }
929  };
930 
931 
932 
933 }} // namespace lib::test
934 #endif /*LIB_TEST_EVENT_LOG_H*/
friend bool operator==(EventLog const &l1, EventLog const &l2)
equality comparison is based on the actual log contents
Definition: event-log.hpp:918
auto matchArgsRegExp(RExSeq &&regExpSeq)
refinement filter, to cover all arguments by regular expression(s)
Definition: event-log.hpp:260
EventLog & warn(string text)
Log a warning entry.
Definition: event-log.hpp:762
EventMatch verifyEvent(string match) const
start a query to match for some event.
Definition: event-log.hpp:868
auto ensureAttribute(string key)
refinement filter to ensure a specific attribute is present on the log entry
Definition: event-log.hpp:290
std::vector< std::regex > RExSeq
Definition: event-log.hpp:92
EventMatch & on(const char *targetID)
Definition: event-log.hpp:527
EventMatch verifyEvent(string classifier, string match) const
Definition: event-log.hpp:876
lib::diff::RecordSetup< string >::Storage ArgSeq
Definition: event-log.hpp:684
string violation_
record when the underlying query has failed
Definition: event-log.hpp:105
Automatically use custom string conversion in C++ stream output.
Filter solution_
match predicate evaluator
Definition: event-log.hpp:96
lib::RangeIter< Log::const_iterator > Iter
Definition: event-log.hpp:561
EventMatch & attrib(string key, string valueMatch)
refine filter to additionally match on a specific attribute
Definition: event-log.hpp:501
EventLog(const char *logID)
Definition: event-log.hpp:596
std::string toString(TY const &val) noexcept
get some string representation of any object, reliably.
Definition: format-obj.hpp:174
EventMatch & on(const X *const targetObj)
Definition: event-log.hpp:536
Definition: run.hpp:49
friend const_iterator end(EventLog const &log)
Definition: event-log.hpp:824
auto matchType(string typeID)
refinement filter to match on the given typeID
Definition: event-log.hpp:279
Helper template(s) for creating Lumiera Forward Iterators.
EventLog & clear(const char *alteredLogID)
Definition: event-log.hpp:668
EventMatch & id(string classifier)
refine filter to additionally match on the ID attribute
Definition: event-log.hpp:510
string getID() const
Definition: event-log.hpp:581
auto findCall(string match)
Definition: event-log.hpp:215
inline string literal This is a marker type to indicate that
Definition: symbol.hpp:75
const_iterator end() const
Definition: event-log.hpp:821
EventLog & create(string text)
Log the creation of an object.
Definition: event-log.hpp:790
Helper to log and verify the occurrence of events.
Definition: event-log.hpp:557
EventMatch & afterCall(string match)
find a function invocation backwards, before the current point of reference
Definition: event-log.hpp:436
An iterator with the ability to switch direction.
EventMatch & arg(ARGS const &...args)
refine filter to additionally require specific arguments
Definition: event-log.hpp:452
string join(CON &&coll, string const &delim=", ")
enumerate a collection's contents, separated by delimiter.
EventLog & call(string target, string function, ArgSeq &&args)
Log a function call with a sequence of stringified arguments.
Definition: event-log.hpp:716
const_iterator begin() const
Definition: event-log.hpp:820
auto matchArguments(ArgSeq &&argSeq)
this filter functor is for refinement of an existing filter
Definition: event-log.hpp:234
lib::diff::RecordSetup< string >::Storage ArgSeq
Definition: event-log.hpp:91
EventLog & clear(string alteredLogID)
purge log contents and also reset Header-ID
Definition: event-log.hpp:660
void log(Symbol typeID, ATTR &&attribs, ARGS &&args)
Definition: event-log.hpp:574
EventLog & call(const char *target, const char *function, ArgSeq &&args)
Definition: event-log.hpp:723
Implementation namespace for support and library code.
EventMatch & beforeCall(string match)
find a match for some function invocation after the current point of reference
Definition: event-log.hpp:390
auto findEvent(string classifier, string match)
Definition: event-log.hpp:202
void evaluateQuery(string matchSpec, Literal rel="after")
this is actually called after each refinement of the filter and matching conditions.
Definition: event-log.hpp:127
EventMatch & before(string match)
find a match (substring match) of the given text in an EventLog entry after the current position ...
Definition: event-log.hpp:336
EventMatch(Log const &srcSeq)
Definition: event-log.hpp:153
Token or Atom with distinct identity.
Definition: symbol.hpp:116
EventMatch & key(string key)
refine filter to additionally require the presence an attribute
Definition: event-log.hpp:492
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
Definition: util.hpp:205
EventLog(string logID)
Definition: event-log.hpp:589
Special collection to represent object-like data.
const Entry value_type
Definition: event-log.hpp:818
bool foundSolution()
core of the evaluation machinery: apply a filter predicate and then pull through the log to find a ac...
Definition: event-log.hpp:112
Marker types to indicate a literal string and a Symbol.
EventLog & call(const char *target, string function, ARGS const &...args)
Definition: event-log.hpp:746
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
EventLog & error(string text)
Log an error note.
Definition: event-log.hpp:771
std::vector< Entry > Log
Definition: event-log.hpp:560
EventMatch & beforeMatch(string regExp)
find a match with the given regular expression
Definition: event-log.hpp:346
EventLog(const X *const obj)
Definition: event-log.hpp:602
EventLog & call(string target, string function)
Log occurrence of a function call with no arguments.
Definition: event-log.hpp:709
EventMatch & beforeEvent(string classifier, string match)
Definition: event-log.hpp:377
bool look_for_match_
support for positive and negative queries.
Definition: event-log.hpp:102
EventMatch & argMatch(ARGS const &...regExps)
refine filter to additionally cover all arguments with a series of regular expressions.
Definition: event-log.hpp:474
EventMatch & afterEvent(string classifier, string match)
Definition: event-log.hpp:426
A cursor-like iterator with the ability to switch iteration direction.
bool isnil(lib::time::Duration const &dur)
Definition: timevalue.hpp:642
EventMatch & afterMatch(string regExp)
Definition: event-log.hpp:408
auto find(string match)
Definition: event-log.hpp:167
EventLog & fatal(string text)
Log a fatal failure.
Definition: event-log.hpp:780
CON stringify(ELMS const &...elms)
convert a sequence of elements to string
Lumiera error handling (C++ interface).
string instanceTypeID(const TY *const obj)
designation of an distinct object instance
Definition: genfunc.hpp:125
std::vector< Entry > Log
Definition: event-log.hpp:87
EventMatch verifyCall(string match) const
start a query to match especially a function call
Definition: event-log.hpp:894
EventLog & destroy(string text)
Log the destruction of an object.
Definition: event-log.hpp:800
EventLog & clear(const X *const obj)
Definition: event-log.hpp:675
EventLog & event(string classifier, string text)
log some event, with additional ID or classifier
Definition: event-log.hpp:698
EventLog & call(const X *const targetObj, string function, ARGS const &...args)
Log a function call on given object ("`this`")...
Definition: event-log.hpp:739
EventLog & joinInto(EventLog &otherLog)
Merge this log into another log, forming a combined log.
Definition: event-log.hpp:627
Collection of small helpers and convenience shortcuts for diagnostics & formatting.
EventMatch verify(string match) const
start a query to match for some substring.
Definition: event-log.hpp:839
std::shared_ptr< Log > log_
Definition: event-log.hpp:563
EventMatch ensureNot(string match) const
start a query to ensure the given expression does not match.
Definition: event-log.hpp:907
EventLog & note(ELMS const &...initialiser)
Definition: event-log.hpp:753
Bare symbolic and hash ID used for accounting of asset like entries.
Accessing a STL element range through a Lumiera forward iterator, An instance of this iterator adapte...
EventLog & clear()
purge log contents while retaining just the original Header-ID
Definition: event-log.hpp:645
EventLog & call(string target, string function, ARGS const &...args)
Log a function call with arbitrary arguments.
Definition: event-log.hpp:731
void log(std::initializer_list< string > const &ili)
Definition: event-log.hpp:567
bool empty() const
Definition: event-log.hpp:811
EventMatch & afterEvent(string match)
Definition: event-log.hpp:417
EventMatch verifyMatch(string regExp) const
start a query to match with a regular expression
Definition: event-log.hpp:853
EventMatch & after(string match)
Definition: event-log.hpp:399
EventMatch & type(string typeID)
refine filter to additionally require a matching log entry type
Definition: event-log.hpp:483
EventMatch verifyEvent(string classifier, X const &something) const
Definition: event-log.hpp:885
EventMatch & beforeEvent(string match)
find a match for an "event" after the current point of reference
Definition: event-log.hpp:368
object-like record of data.
Definition: record.hpp:143
auto matchAttribute(string key, string valueMatch)
refinement filter to ensure a specific attribute is present on the log entry
Definition: event-log.hpp:301
EventLog & event(string text)
Definition: event-log.hpp:687
auto findRegExp(string regExpDef)
Definition: event-log.hpp:176
string lastMatch_
record last match for diagnostics
Definition: event-log.hpp:99
auto findEvent(string match)
Definition: event-log.hpp:186
friend const_iterator begin(EventLog const &log)
Definition: event-log.hpp:823
EventMatch & on(string targetID)
refine filter to additionally match the 'this' attribute
Definition: event-log.hpp:519
friend bool operator!=(EventLog const &l1, EventLog const &l2)
Definition: event-log.hpp:925