Logger.cs 1.3 KB

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