using System; namespace Logging { public class Logging { private static LoggingType[] _ActiveLoggingTypes { get; set; } public enum LoggingType { TRACE, ERROR, DEBUG, WARNING, INFO, ALL } private static void AddLogMessage(LoggingType messagetype, string message) { if(CheckLoggingType(messagetype)) PrintToConsole(messagetype, message); } private static bool CheckLoggingType(LoggingType lt){ if (_ActiveLoggingTypes.Length < 1) { _ActiveLoggingTypes = new LoggingType[1]; _ActiveLoggingTypes[0] = LoggingType.ALL; } bool found = false; foreach(LoggingType l in _ActiveLoggingTypes) { if (l == lt || l == LoggingType.ALL) { found = true; break; } } return found; } private static void PrintToConsole(LoggingType lt, string message) { Console.WriteLine("[" + lt.ToString() + "]" + message); } } }