Exemple #1
0
        /// <summary>
        /// LoggingEventConverterExtension constructor
        /// </summary>
        /// <param name="innerConv">Converter to be wrapped</param>
        /// <param name="prefix">Prefix string</param>
        /// <param name="suffix">Suffix string</param>
        /// <param name="valueOnNull">Fallback value for 'null'</param>
        public LoggingEventConverterExtension(LoggingEventConverterBase innerConv, string prefix, string suffix, string valueOnNull)
        {
            Contract.Requires(innerConv != null);
            _innerConv   = innerConv;
            _prefix      = prefix;
            _suffix      = suffix;
            _valueOnNull = valueOnNull;

            if (prefix == null && suffix == null)
            {
                _conversionWay = ConversionWay.NoPrefixSuffix;
            }
            else if (prefix != null && suffix == null)
            {
                _conversionWay = ConversionWay.PrefixOnly;
            }
            else if (prefix == null && suffix != null)
            {
                _conversionWay = ConversionWay.SuffixOnly;
            }
            else
            {
                _conversionWay = ConversionWay.PrefixAndSuffix;
            }
        }
Exemple #2
0
 /// <summary>
 /// LoggingEventConverterExtension constructor
 /// </summary>
 /// <param name="innerConv">Converter to be wrapped</param>
 /// <param name="valueOnNull">Fallback value for 'null'</param>
 public LoggingEventConverterExtension(LoggingEventConverterBase innerConv, string valueOnNull)
 {
     Contract.Requires(innerConv != null);
     _innerConv     = innerConv;
     _valueOnNull   = valueOnNull;
     _conversionWay = ConversionWay.NoPrefixSuffix;
 }