Logger.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. namespace BBIWARG.Utility
  3. {
  4. /// <summary>
  5. /// flags describing the different log subjects
  6. /// </summary>
  7. public enum LogSubject
  8. {
  9. None = 0,
  10. FingerDetector = 1,
  11. FingerTracker = 2,
  12. HandDetector = 4,
  13. PalmDetector = 8,
  14. TouchDetector = 16,
  15. TouchTracker = 32,
  16. TUIOServer = 64,
  17. TouchEvents = 128,
  18. VideoControls = 256,
  19. HandTracker = 512,
  20. PalmTracker = 1024
  21. }
  22. /// <summary>
  23. /// Logs messages.
  24. /// </summary>
  25. internal static class Logger
  26. {
  27. /// <summary>
  28. /// the current frame
  29. /// </summary>
  30. public static int CurrentFrame { get; set; }
  31. /// <summary>
  32. /// May print a message depending on the subject and <see cref="Parameters.LoggerEnabledSubjects"/>.
  33. /// </summary>
  34. /// <param name="message">the message</param>
  35. /// <param name="subject">the subject the message belongs to, determines if this message is printed</param>
  36. public static void log(string message, LogSubject subject)
  37. {
  38. if (Parameters.LoggerEnabledSubjects.HasFlag(subject))
  39. Console.WriteLine("Frame: " + CurrentFrame + "\t" + message);
  40. }
  41. }
  42. }