Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JsonInterceptedLogger"/> class.
        /// </summary>
        /// <param name="innerLogger">The inner logger.</param>
        /// <param name="interceptor">The interceptor.</param>
        public JsonInterceptedLogger(IJsonLogger innerLogger, [CanBeNull] JsonLogEntryInterceptor interceptor)
        {
            _innerLogger = innerLogger ?? throw new ArgumentNullException(nameof(innerLogger));
            interceptor  = interceptor.DoNothingIfNull();

            _builder = interceptor(this);
        }
Esempio n. 2
0
 /// <summary>
 /// Replaces <see langword="null"/> passed to the <paramref name="interceptor"/> with the "do nothing" interceptor.
 /// </summary>
 /// <param name="interceptor">The interceptor or null.</param>
 /// <returns>Always not null interceptor.</returns>
 public static JsonLogEntryInterceptor DoNothingIfNull([CanBeNull] this JsonLogEntryInterceptor interceptor)
 {
     return(interceptor ?? DoNothingInterceptor);
 }