// public public void AddDestination(CommonDestination key, Vector3 destination) { if (!Destinations.ContainsKey(key)) { Destinations[key] = destination; } }
/// <summary> /// Will add a new LoggingDestination to the pool of targets. /// </summary> /// <param name="newDest">Either an existing or a custom Destination that implements the ILoggingDestination interface.</param> public static void AddDestination(ILoggingDestination newDest) { if (!Destinations.ContainsKey(_nonGenericTypDestination)) Destinations.Add(_nonGenericTypDestination, new List<IDestination>()); Destinations[_nonGenericTypDestination].Add(newDest); }
public void Work() { if (Destinations.ContainsKey(CommonDestination.Craft)) { SetDestination(Destinations[CommonDestination.Craft]); } else if (Destinations.ContainsKey(CommonDestination.Harvest)) { SetDestination(Destinations[CommonDestination.Harvest]); } }
/// <summary> /// Now hidden, you shouldn't need to use this method directly, only use the shortcut methods below /// </summary> /// <param name="level">The severity level of the log statement.</param> /// <param name="message">The message you wish to convey in the log entry.</param> /// <param name="ex">Optional, pass if you have an exception you want to add to the log entry.</param> private static void Log(LogLevels level, string message, Exception ex = null) { if (!Destinations.ContainsKey(_nonGenericTypDestination)) Destinations.Add(_nonGenericTypDestination, new List<IDestination>()); if (Destinations[_nonGenericTypDestination].Count == 0) AddDestination(new FileDestination($"Default Log {DateTime.Now:yyyy-MM-dd hh-mm}.log")); foreach (ILoggingDestination dest in Destinations[_nonGenericTypDestination]) if (dest.ValidateMessageLevel(level)) dest.Log(level, message, ex); }
/// <summary> /// Resets the pool of targets, removes any/all Destinations that have been added. /// </summary> public static void ClearDestinations() { if (Destinations.ContainsKey(_nonGenericTypDestination)) Destinations[_nonGenericTypDestination].Clear(); }
/// <summary> /// If you retain a reference to your LoggingDestination, you can remove it from the pool of targets. /// </summary> /// <param name="destToRemove">Either an existing or a custom Destination that implements the ILoggingDestination interface; must have already been added to the pool via "AddDestination".</param> public static void RemoveDestination(ILoggingDestination destToRemove) { if (Destinations.ContainsKey(_nonGenericTypDestination)) Destinations[_nonGenericTypDestination].Remove(destToRemove); }