private static void ThrowArgumentNullException(DomainLogger logger, string tag, string message) { var ex = new ArgumentNullException(message); logger.E(tag, ex.ToString() ?? ""); throw ex; }
private void CreateAndAddLogger(string domain, int index) { var logger = new DomainLogger(domain, true) { Level = Log.LogLevel.Base }; _allLoggers[index] = logger; }
public static unsafe void *MustNotBeNullPointer([NotNull] DomainLogger logger, [NotNull] string tag, [NotNull] string argumentName, void *argumentValue) { Debug.Assert(argumentValue != null); if (argumentValue == null) { ThrowArgumentNullException(logger, tag, argumentName); } return(argumentValue); }
public static T MustNotBeNull <T>([NotNull] DomainLogger logger, [NotNull] string tag, [NotNull] string argumentName, T argumentValue) where T : class { Debug.Assert(argumentValue != null); if (argumentValue == null) { ThrowArgumentNullException(logger, tag, argumentName); } return(argumentValue); }
public static unsafe void *MustNotBeNullPointer([NotNull] DomainLogger logger, [NotNull] string tag, [NotNull] string argumentName, void *argumentValue) { Debug.Assert(argumentValue != null); if (argumentValue == null) { var ex = new ArgumentNullException(argumentName); logger.E(tag, ex.ToString() ?? ""); throw ex; } return(argumentValue); }
public static T MustNotBeNull <T>([NotNull] DomainLogger logger, [NotNull] string tag, [NotNull] string argumentName, T argumentValue) where T : class { Debug.Assert(argumentValue != null); if (argumentValue == null) { var ex = new ArgumentNullException(argumentName); logger.E(tag, ex.ToString() ?? ""); throw ex; } return(argumentValue); }
public static void LogAndThrow([NotNull] DomainLogger logger, [NotNull] Exception e, [NotNull] string tag, [NotNull] string message, bool fatal) { if (fatal) { logger.E(tag, message, e); } else { logger.W(tag, message, e); } throw e; }
public static IEnumerable <T> ItemsMustNotBeNull <T>([NotNull] DomainLogger logger, [NotNull] string tag, [NotNull] string argumentName, IEnumerable <T> argumentValues) where T : class { Debug.Assert(argumentValues != null); if (argumentValues == null) { ThrowArgumentNullException(logger, tag, argumentName); } else { int index = 0; foreach (var item in argumentValues) { if (item == null) { ThrowArgumentNullException(logger, tag, $"{argumentName}[{index}]"); } index++; } } return(argumentValues); }
public OneShotEnumerator(DomainLogger parent) { _parent = parent; }
public static void AssertAndLog([NotNull] DomainLogger logger, bool assertion, [NotNull] string tag, [NotNull] string message) { Debug.Assert(assertion, message); logger.W(tag, message); }