Logger.cs 949 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. namespace csharp_sccd_compiler
  3. {
  4. public class Logger
  5. {
  6. /// <summary>
  7. /// Gets or sets the verbose of the logger.
  8. /// </summary>
  9. /// <value>The verbose. -1 = no ouput; 0 = only errors; 1 = only warnings and errors; 2 = all output.</value>
  10. static public int verbose = 2;
  11. private Logger()
  12. {
  13. }
  14. public static void displayError(string message)
  15. {
  16. if (Logger.verbose > -1)
  17. Console.WriteLine(string.Format("ERROR : {0}", message));
  18. }
  19. public static void displayWarning(string message)
  20. {
  21. if (Logger.verbose > 0)
  22. Console.WriteLine(string.Format("WARNING : {0}", message));
  23. }
  24. public static void displayInfo(string message)
  25. {
  26. if (Logger.verbose > 1)
  27. Console.WriteLine(string.Format("INFO : {0}", message));
  28. }
  29. }
  30. }