Пример #1
0
//    public Func<LogLevel, EventId, object, Exception, SqlCommand> SqlCommandFormatter { get; set; }

        #region Public Methods

        public SqlLogger(ISqlBatchLogTask logger, ISqlLoggerSettings settings, string categoryName, Func <string, LogLevel, bool> filter = null)
        {
            _logger = logger;
            try
            {
                _settings = settings;

                if (_settings.ScopeSeparator == null)
                {
                    _settings.ScopeSeparator = "=>";
                }

                _categoryName = categoryName;
                if (filter == null)
                {
                    _filter = ((category, logLevel) => true);
                }
                else
                {
                    _filter = filter;
                }

                _ignoreLoggingErrors = settings.IgnoreLoggingErrors;
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
 /// <summary>
 /// Creates SQL Logger Provider
 /// </summary>
 /// <param name="settings">Logger Settings</param>
 /// <param name="filter">TODO..</param>
 public SqlLogProvider(ISqlBatchLogTask logger, IOptions <SqlLoggerSettings> settings) : this(logger, settings.Value)
 {
 }
 /// <summary>
 /// Creates SQL Logger Provider
 /// </summary>
 /// <param name="settings">Logger Settings</param>
 /// <param name="filter">TODO..</param>
 public SqlLogProvider(ISqlBatchLogTask logger, ISqlLoggerSettings settings)
 {
     this._settings = settings;
     _logger        = logger;
 }