/// <summary> /// 通知观察者; /// </summary> private static void NotifyNext(ConsoleEvent consoleEvent) { lock (asyncLock) { observerCollection.NotifyNextSafe(consoleEvent); } }
/// <summary> /// 记录成功条目; /// </summary> public static void WriteSuccessful(string message) { ConsoleEvent consoleEvent = new ConsoleEvent() { EventType = ConsoleEventType.Successful, Message = message, }; NotifyNext(consoleEvent); }
/// <summary> /// 记录异常条目; /// </summary> public static void WriteError(string message) { ConsoleEvent consoleEvent = new ConsoleEvent() { EventType = ConsoleEventType.Error, Message = message, }; NotifyNext(consoleEvent); }
/// <summary> /// 记录方法条目; /// </summary> public static void WriteMethod(string message) { ConsoleEvent consoleEvent = new ConsoleEvent() { EventType = ConsoleEventType.Method, Message = message, }; NotifyNext(consoleEvent); }
/// <summary> /// 记录警告条目; /// </summary> public static void WriteWarning(string message) { ConsoleEvent consoleEvent = new ConsoleEvent() { EventType = ConsoleEventType.Warning, Message = message, }; NotifyNext(consoleEvent); }