DeadByDaylightBackup.Logging/LoggerFactory.cs
/// <summary>
/// Set a logger type a single time only!
/// Throws exceptions if it is not accaptable
/// </summary>
/// <param name="type">The type to set</param>
Set a logger type a single time only.
Throws exceptions if it is not accaptable
Set a logger type a single time only . Throws exceptions if it is not accaptable
public static void SetLoggerType(Type type)
        {
            if (type == null) throw new ArgumentNullException(nameof(type));
            if (!typeof(ILogger).IsAssignableFrom(type)) throw new InvalidCastException($"Cannot cast {type.FullName.ToString()} to {typeof(ILogger).FullName.ToString()}!");
            if (!type.IsClass || type.IsAbstract || type.IsInterface) throw new NotSupportedException($"{type.FullName.ToString()} cannot be instantiated!");
            lock (_lock)
            {
                if (_types == null || !_types.Any())
                {
                    _types = new[] { type };
                }
                else
                {
                    throw new InvalidOperationException($"Logger is already set to: {type.FullName.ToString()}!");
                }
            }
        }
public static void SetLoggerType ( Type type ) { if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ; if ( ! typeof ( ILogger ) . IsAssignableFrom ( type ) ) throw new InvalidCastException ( $" Cannot cast  { type . FullName . ToString ( ) }  to  { typeof ( ILogger ) . FullName . ToString ( ) } ! " ) ; if ( ! type . IsClass || type . IsAbstract || type . IsInterface ) throw new NotSupportedException ( $" { type . FullName . ToString ( ) }  cannot be instantiated! " ) ; lock ( _lock ) { if ( _types == null || ! _types . Any ( ) ) { _types = new [ ] { type } ; } else { throw new InvalidOperationException ( $" Logger is already set to:  { type . FullName . ToString ( ) } ! " ) ; } } }
Set a logger type a single time only!
Set a logger type a single time only!
type
Type
The type to set
The type to set